• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python misc.wxstr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中misc.wxstr函数的典型用法代码示例。如果您正苦于以下问题:Python wxstr函数的具体用法?Python wxstr怎么用?Python wxstr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wxstr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: save_template

def save_template(data=None):
    """\
    Returns an out file name and template description for saving a template
    """
    dlg = templates_ui.TemplateInfoDialog(None, -1, "")
    if data is not None:
        dlg.template_name.SetValue(
            misc.wxstr(os.path.basename(os.path.splitext(data.filename)[0])))
        dlg.author.SetValue(misc.wxstr(data.author))
        dlg.description.SetValue(misc.wxstr(data.description))
        dlg.instructions.SetValue(misc.wxstr(data.instructions))
    ret = None
    retdata = Template()
    if dlg.ShowModal() == wx.ID_OK:
        ret = dlg.template_name.GetValue().strip()
        retdata.author = dlg.author.GetValue()
        retdata.description = dlg.description.GetValue()
        retdata.instructions = dlg.instructions.GetValue()
        if not ret:
            wx.MessageBox(_("Can't save a template with an empty name"),
                          _("Error"), wx.OK|wx.ICON_ERROR)
    dlg.Destroy()
    name = ret
    if ret:
        d = os.path.join(config._get_appdatapath(), '.wxglade', 'templates')
        if not os.path.exists(d):
            try:
                os.makedirs(d)
            except (OSError, IOError), e:
                print _("ERROR creating %s: %s") % (d, e)
                return None, retdata
        ret = os.path.join(d, ret + '.wgt')
开发者ID:dsqiu,项目名称:qzystudy,代码行数:32,代码来源:template.py


示例2: write

 def write( self, outfile, tabs ):
     if self.write_always or ( self.is_active() and self.get_value() ):
         if self.getter: value = misc.wxstr( self.getter() )
         else: value = misc.wxstr( self.owner[self.name][0]() )
         if value != 'None':
             fwrite = outfile.write
             fwrite( '    ' * tabs + '<%s>' % self.name )
             fwrite( escape( _encode( value ) ) )
             fwrite( '</%s>\n' % self.name )
开发者ID:JeffHanna,项目名称:wxArchitect,代码行数:9,代码来源:widget_properties.py


示例3: createBrowseButton

 def createBrowseButton( self):
     """Create the browse-button control"""
     ID = wx.NewId()
     button =wx.Button(self, ID, misc.wxstr(self.buttonText))
     button.SetToolTipString(misc.wxstr(self.toolTip))
     w = button.GetTextExtent(self.buttonText)[0] + 10
     button.SetMinSize((w, -1))
     wx.EVT_BUTTON(button, ID, self.OnBrowse)
     return button
开发者ID:dsqiu,项目名称:qzystudy,代码行数:9,代码来源:toolbar.py


示例4: write

 def write(self, outfile, tabs):
     if self.write_always or self.get_value():
         if self.getter:
             value = misc.wxstr(self.getter())
         else:
             value = misc.wxstr(self.owner[self.name][0]())
         if value != "None":
             fwrite = outfile.write
             fwrite("    " * tabs + "<%s>" % self.name)
             fwrite(escape(_encode(value)))
             fwrite("</%s>\n" % self.name)
开发者ID:nyimbi,项目名称:SPE,代码行数:11,代码来源:widget_properties.py


示例5: set_value

 def set_value(self, value):
     value = misc.wxstr(value)
     if not misc.streq(value, self.value):
         self.value = value
         if self.style & wx.TE_MULTILINE:
             value = value.replace('\\n', '\n')
         if self.widget: self.widget.SetValue(value)
开发者ID:CrazyPython,项目名称:SPE,代码行数:7,代码来源:text_ctrl.py


示例6: _move_item_right

 def _move_item_right(self, index):
     if index > 0 and (self.item_level(index) <= self.item_level(index-1)): 
         label = self.menu_items.GetItem(index, 0).m_text
         self.menu_items.SetStringItem(index, 0, misc.wxstr(" " * 4)
                                       + label)
         self.menu_items.SetItemState(index, wx.LIST_STATE_SELECTED, \
                                      wx.LIST_STATE_SELECTED)
开发者ID:CrazyPython,项目名称:SPE,代码行数:7,代码来源:menubar.py


示例7: load_history

def load_history():
    """\
    Loads the file history and returns a list of paths
    """
    if 'WXGLADE_CONFIG_PATH' in os.environ:
        path = os.path.expandvars('$WXGLADE_CONFIG_PATH')
    else:
        path = _get_appdatapath()
        if path != common.wxglade_path:
            path = os.path.join(path, '.wxglade')
    try:
        history = open(os.path.join(path, 'file_history.txt'))
        l = history.readlines()
        if l and l[0].startswith('# -*- coding:'):
            try:
                encoding = 'utf-8' 
                #l = [common._encode_from_xml(e, encoding) for e in l[1:]]
                l = [e.decode(encoding) for e in l[1:]]
            except Exception, e:
                print _("ERR:"), e
                l = l[1:]
        history.close()
        if common.use_gui:
            l = [misc.wxstr(e, 'utf-8') for e in l]
        return l
开发者ID:CrazyPython,项目名称:SPE,代码行数:25,代码来源:config.py


示例8: kde_file_selector

def kde_file_selector(message, default_path="", default_filename="",
                      default_extension="", wildcard="*.*", flags=0,
                      *args, **kwds):
    """\
    Pops up the standard KDE file selector box, calling kdialog. The API is
    identical to that of wx.FileSelector. If kdialog can't be invoked,
    reverts to the standard wx.FileSelector. Note that at the moment not all
    the arguments are meaningful (for example, parent and initial position are
    ignored), and multiple selections are not supported.
    """
    if not _kdialog_ok:
        return wx.FileSelector(message, default_path, default_filename,
                               default_extension, wildcard, flags,
                               *args, **kwds)
    
    r, w = os.pipe()
    handler = _SigChldHandler()
    oldhandler = signal.signal(signal.SIGCHLD, handler)

    pid = os.fork()

    if pid == 0:
        os.close(r)
        os.dup2(w, sys.stdout.fileno())
        os.close(w)
        startdir = default_path
        if default_filename:
            if not os.path.isdir(startdir):
                startdir = os.path.dirname(startdir)
            startdir = os.path.join(startdir, default_filename)
        if flags & wx.SAVE:
            kind = '--getsavefilename'
        else:
            kind = '--getopenfilename'
        os.execlp('kdialog', 'kdialog', kind, startdir,
                  _wx_to_kde_wildcard(wildcard), '--title', message)
    elif pid > 0:
        disabler = wx.WindowDisabler()
        app = wx.GetApp()
        os.close(w)
        while not handler.done:
            app.Dispatch()
        if handler.status != 0:
            os.close(r)
            return ""

        filename = os.fdopen(r).readline().strip()
        signal.signal(signal.SIGCHLD, oldhandler or signal.SIG_DFL)
        if (flags & wx.SAVE) and (flags & wx.OVERWRITE_PROMPT) and \
               os.path.exists(filename):
            if wx.MessageBox(_("File '%s' already exists: do you really want "
                               "to overwrite it?") % misc.wxstr(filename),
                             _("Confirm"),
                             style=wx.YES_NO|wx.ICON_QUESTION) == wx.NO:
                return kde_file_selector(message, default_path,
                                         default_filename, default_extension,
                                         wildcard, flags)
        return filename
    else:
        raise OSError, _("Fork Error")
开发者ID:CrazyPython,项目名称:SPE,代码行数:60,代码来源:kdefiledialog.py


示例9: display

    def display( self, parent ):
        """\
        Actually builds the panel (with the text ctrl and the button to display
        the dialog) to set the value of the property interactively
        """
        self.id = wx.NewId()
        val = misc.wxstr( self.owner[self.name][0]() )
        label = wxGenStaticText( parent, -1, _mangle( self.dispName ),
                                size = ( _label_initial_width, -1 ) )
        label.SetToolTip( wx.ToolTip( _mangle( self.dispName ) ) )
        self.text = wx.TextCtrl( parent, self.id, val, size = ( 1, -1 ) )
        self.btn = wx.Button( parent, self.id + 1, " ... ",
                            size = ( _label_initial_width, -1 ) )
        enabler = None
        if self.can_disable:
            enabler = wx.CheckBox( parent, self.id + 1, '', size = ( 1, -1 ) )
            wx.EVT_CHECKBOX( enabler, self.id + 1,
                         lambda event: self.toggle_active( event.IsChecked() ) )
        self.prepare_activator( enabler, self.text )
        if self.can_disable:
            self.btn.Enable( self.is_active() )
        wx.EVT_BUTTON( self.btn, self.id + 1, self.display_dialog )
        sizer = wx.BoxSizer( wx.HORIZONTAL )
        sizer.Add( label, 2, wx.ALL | wx.ALIGN_CENTER, 3 )
        if getattr( self, '_enabler', None ) is not None:
            sizer.Add( self._enabler, 1, wx.ALL | wx.ALIGN_CENTER, 3 )
            option = 3
        else:
            option = 4
        sizer.Add( self.text, option, wx.ALL | wx.ALIGN_CENTER, 3 )
        sizer.Add( self.btn, 1, wx.ALL | wx.ALIGN_CENTER, 3 )
        self.panel = sizer

        self.bind_event( self.on_change_val )
        wx.EVT_CHAR( self.text, self.on_char )
开发者ID:JeffHanna,项目名称:wxArchitect,代码行数:35,代码来源:widget_properties.py


示例10: add

 def add(node, index):
     label = get(index, 0).lstrip()
     id = get(index, 1)
     name = get(index, 2)
     help_str = get(index, 3)
     event_handler = get(index, 5)
     try:
         item_type = int(get(index, 4))
     except ValueError:
         item_type = 0
     checkable = item_type == 1 and misc.wxstr("1") or misc.wxstr("")
     radio = item_type == 2 and misc.wxstr("1") or misc.wxstr("")
     n = MenuTree.Node(label, id, name, help_str, checkable, radio,
                       handler=event_handler)
     node.children.append(n)
     n.parent = node
     return n
开发者ID:CrazyPython,项目名称:SPE,代码行数:17,代码来源:menubar.py


示例11: set_value

 def set_value( self, value ):
     value = misc.wxstr( value )
     if self.multiline:
         self.val = value.replace( '\n', '\\n' )
         value = value.replace( '\\n', '\n' )
     else: self.val = value
     try: self.text.SetValue( value )
     except AttributeError: pass
开发者ID:JeffHanna,项目名称:wxArchitect,代码行数:8,代码来源:widget_properties.py


示例12: set_label

 def set_label(self, value):
     value = misc.wxstr(value)
     if not misc.streq(value, self.label):
         self.label = value
         if self.widget:
             self.widget.SetLabel(value.replace("\\n", "\n"))
             if not self.properties["size"].is_active():
                 self.sizer.set_item(self.pos, size=self.widget.GetBestSize())
开发者ID:nyimbi,项目名称:SPE,代码行数:8,代码来源:radio_button.py


示例13: set_choices

 def set_choices(self, values):
     self.choices = [ misc.wxstr(v[0]) for v in values ]
     self.properties['selection'].set_range(0, len(self.choices)-1)
     if self.widget:
         self.widget.Clear()
         for c in self.choices: self.widget.Append(c)
         if not self.properties['size'].is_active():
             self.sizer.set_item(self.pos, size=self.widget.GetBestSize())
开发者ID:CrazyPython,项目名称:SPE,代码行数:8,代码来源:combo_box.py


示例14: set_label

 def set_label(self, value):
     value = misc.wxstr(value)
     if not misc.streq(value, self.label):
         self.label = value
         if self.static_box:
             self.static_box.SetLabel(value)
             if not self.properties['size'].is_active():
                 self.sizer.set_item(self.pos,
                                     size=self.widget.GetBestSize())
开发者ID:CrazyPython,项目名称:SPE,代码行数:9,代码来源:radio_box.py


示例15: add

 def add(tool):
     i = index[0]
     add_item(i, misc.wxstr(tool.label))
     set_item(i, 1, misc.wxstr(tool.id))
     set_item(i, 2, misc.wxstr(tool.bitmap1))
     set_item(i, 3, misc.wxstr(tool.bitmap2))
     set_item(i, 4, misc.wxstr(tool.short_help))
     set_item(i, 5, misc.wxstr(tool.long_help))
     set_item(i, 7, misc.wxstr(tool.handler))
     item_type = 0
     set_item(i, 6, misc.wxstr(tool.type))
     index[0] += 1
开发者ID:CrazyPython,项目名称:SPE,代码行数:12,代码来源:toolbar.py


示例16: __call__

	def __call__( self, kind, fmt, *args ):
		if self.disabled:
				return
		kind = kind.upper()
		if use_gui:
				import wx, misc
				if args:
					msg = misc.wxstr( fmt ) % tuple( [misc.wxstr( a ) for a in args] )
				else:
					msg = misc.wxstr( fmt )
				self.lines.extend( msg.splitlines() )
##             if kind == 'WARNING':
##                 wx.LogWarning(msg)
##             else:
##                 wx.LogMessage(msg)
		else:
				if args: msg = fmt % tuple( args )
				else: msg = fmt
				print "%s: %s" % ( kind, msg )
开发者ID:JeffHanna,项目名称:wxArchitect,代码行数:19,代码来源:common.py


示例17: _open_app

    def _open_app(self, infilename, use_progress_dialog=True,
                  is_filelike=False, add_to_history=True):
        import time
        from xml_parse import XmlWidgetBuilder, ProgressXmlWidgetBuilder, \
             XmlParsingError
        from xml.sax import SAXParseException

        start = time.clock()

        common.app_tree.clear()
        if not is_filelike:
            common.app_tree.app.filename = infilename
        else:
            common.app_tree.filename = getattr(infilename, 'name', None)
        common.property_panel.Reparent(self.hidden_frame)
        # prevent the auto-expansion of nodes
        common.app_tree.auto_expand = False

        old_dir = os.getcwd()
        try:
            if not is_filelike:
                os.chdir(os.path.dirname(infilename))
                infile = open(infilename)
            else:
                infile = infilename
                infilename = getattr(infile, 'name', None)
            if use_progress_dialog and config.preferences.show_progress:
                p = ProgressXmlWidgetBuilder(input_file=infile)
            else:
                p = XmlWidgetBuilder()
            p.parse(infile)
        except (IOError, OSError, SAXParseException, XmlParsingError), msg:
            if locals().has_key('infile') and not is_filelike: infile.close()
            common.app_tree.clear()
            common.property_panel.Reparent(self.frame2)
            common.app_tree.app.saved = True
            wx.MessageBox(_("Error loading file %s: %s") % \
                          (misc.wxstr(infilename), misc.wxstr(msg)),
                          _("Error"), wx.OK|wx.CENTRE|wx.ICON_ERROR)
            # reset the auto-expansion of nodes
            common.app_tree.auto_expand = True
            os.chdir(old_dir)
            return False            
开发者ID:CrazyPython,项目名称:SPE,代码行数:43,代码来源:main.py


示例18: __call__

    def __call__(self, kind, fmt, *args):
        if self.disabled:
            return
        kind = kind.upper()
        if use_gui:
            import misc
            if args:
                msg = misc.wxstr(fmt) % tuple([misc.wxstr(a) for a in args])
            else:
                msg = misc.wxstr(fmt)
            self.lines.extend(msg.splitlines())

        # show errors and exceptions always at console
        if not use_gui or kind in [_("EXCEPTION"),  _("ERROR")]:
            if args:
                msg = fmt % tuple(args)
            else:
                msg = fmt
            print "%s: %s" % (kind, msg)
开发者ID:dsqiu,项目名称:qzystudy,代码行数:19,代码来源:common.py


示例19: end_elem

 def end_elem(self, name):
     if name == 'tabs':
         self.parent.tabs = [[misc.wxstr(name), None] for name in \
                             self.tab_names]
         self.parent.properties['tabs'].set_value([[name] for name in \
                                                   self.tab_names])
         return True
     elif name == 'tab':
         self.tab_names.append("".join(self.curr_tab))
         self.curr_tab = []
     return False
开发者ID:dsqiu,项目名称:qzystudy,代码行数:11,代码来源:notebook.py


示例20: set_tools

 def set_tools(self, tools):
     self.tools = tools
     if not self._tb: return # nothing left to do
     while self._tb.DeleteToolByPos(0):
         pass # clear the toolbar
     # now add all the tools
     for tool in self.tools:
         if misc.streq(tool.id, '---'): # the tool is a separator
             self._tb.AddSeparator()
         else:
             if tool.bitmap1:
                 bmp1 = None
                 if not (tool.bitmap1.startswith('var:') or
                         tool.bitmap1.startswith('code:')):
                     bmp1 = wx.Bitmap(
                         misc.get_relative_path(misc.wxstr(tool.bitmap1)),
                         wx.BITMAP_TYPE_ANY)
                 if not bmp1 or not bmp1.Ok(): bmp1 = wx.EmptyBitmap(1, 1)
             else:
                 bmp1 = wx.NullBitmap
             if tool.bitmap2:
                 bmp2 = None
                 if not (tool.bitmap2.startswith('var:') or
                         tool.bitmap2.startswith('code:')):
                     bmp2 = wx.Bitmap(
                         misc.get_relative_path(misc.wxstr(tool.bitmap2)),
                         wx.BITMAP_TYPE_ANY)
                 if not bmp2 or not bmp2.Ok(): bmp2 = wx.EmptyBitmap(1, 1)
             else:
                 bmp2 = wx.NullBitmap
             kinds = [wx.ITEM_NORMAL, wx.ITEM_CHECK, wx.ITEM_RADIO]
             try:
                 kind = kinds[int(tool.type)]
             except (ValueError, IndexError):
                 kind = wx.ITEM_NORMAL
             self._tb.AddLabelTool(wx.NewId(), misc.wxstr(tool.label),
                                   bmp1, bmp2, kind,
                                   misc.wxstr(tool.short_help),
                                   misc.wxstr(tool.long_help))
     # this is required to refresh the toolbar properly
     self._refresh_widget()
开发者ID:dsqiu,项目名称:qzystudy,代码行数:41,代码来源:toolbar.py



注:本文中的misc.wxstr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python misc.Logger类代码示例发布时间:2022-05-27
下一篇:
Python misc.ustr函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap