当前位置: 首页>>代码示例>>Python>>正文


Python qthelpers.translate函数代码示例

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


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

示例1: show_docstring

 def show_docstring(self, text, call=False):
     """Show docstring or arguments"""
     if not self.calltips:
         return
     
     text = unicode(text) # Useful only for ExternalShellBase
     
     if (self.docviewer is not None) and \
        (self.docviewer.dockwidget.isVisible()):
         # DocViewer widget exists and is visible
         self.docviewer.refresh(text)
         self.setFocus() # if docviewer was not at top level, raising it to
                         # top will automatically give it focus because of
                         # the visibility_changed signal, so we must give
                         # focus back to shell
         if call:
             # Display argument list if this is function call
             iscallable = self.iscallable(text)
             if iscallable is not None:
                 if iscallable:
                     arglist = self.get_arglist(text)
                     if arglist:
                         self.show_calltip(translate("PythonShellWidget",
                                                     "Arguments"),
                                           arglist, '#129625')
     else: # docviewer is not visible
         doc = self.get__doc__(text)
         if doc is not None:
             self.show_calltip(translate("PythonShellWidget",
                                         "Documentation"), doc)
开发者ID:Brainsciences,项目名称:luminoso,代码行数:30,代码来源:shell.py

示例2: get_toolbar_buttons

 def get_toolbar_buttons(self):
     if self.run_button is None:
         self.run_button = create_toolbutton(self, get_icon('run.png'),
                           translate('ExternalShellBase', "Run"),
                           tip=translate('ExternalShellBase',
                                         "Run again this program"),
                           triggered=self.start)
     if self.kill_button is None:
         self.kill_button = create_toolbutton(self, get_icon('kill.png'),
                           translate('ExternalShellBase', "Kill"),
                           tip=translate('ExternalShellBase',
                                         "Kills the current process, "
                                         "causing it to exit immediately"))
     buttons = [self.run_button, self.kill_button]
     if self.options_button is None:
         options = self.get_options_menu()
         if options:
             self.options_button = create_toolbutton(self,
                                         text=self.tr("Options"),
                                         icon=get_icon('tooloptions.png'))
             self.options_button.setPopupMode(QToolButton.InstantPopup)
             menu = QMenu(self)
             add_actions(menu, options)
             self.options_button.setMenu(menu)
     if self.options_button is not None:
         buttons.insert(1, self.options_button)
     return buttons
开发者ID:cheesinglee,项目名称:spyder,代码行数:27,代码来源:__init__.py

示例3: setup_context_menu

 def setup_context_menu(self):
     """Setup shell context menu"""
     self.menu = QMenu(self)
     self.cut_action = create_action(self,
                                     translate("ShellBaseWidget", "Cut"),
                                     shortcut=keybinding('Cut'),
                                     icon=get_icon('editcut.png'),
                                     triggered=self.cut)
     self.copy_action = create_action(self,
                                      translate("ShellBaseWidget", "Copy"),
                                      shortcut=keybinding('Copy'),
                                      icon=get_icon('editcopy.png'),
                                      triggered=self.copy)
     paste_action = create_action(self,
                                  translate("ShellBaseWidget", "Paste"),
                                  shortcut=keybinding('Paste'),
                                  icon=get_icon('editpaste.png'),
                                  triggered=self.paste)
     save_action = create_action(self,
                                 translate("ShellBaseWidget",
                                           "Save history log..."),
                                 icon=get_icon('filesave.png'),
                                 tip=translate("ShellBaseWidget",
                                       "Save current history log (i.e. all "
                                       "inputs and outputs) in a text file"),
                                 triggered=self.save_historylog)
     add_actions(self.menu, (self.cut_action, self.copy_action,
                             paste_action, None, save_action) )
开发者ID:Brainsciences,项目名称:luminoso,代码行数:28,代码来源:shell.py

示例4: insert_item

 def insert_item(self):
     """Insert item"""
     index = self.currentIndex()
     if not index.isValid():
         row = self.model.rowCount()
     else:
         row = index.row()
     data = self.model.get_data()
     if isinstance(data, list):
         key = row
         data.insert(row, '')
     elif isinstance(data, dict):
         key, valid = QInputDialog.getText(self,
                           translate("DictEditor", 'Insert'),
                           translate("DictEditor", 'Key:'),
                           QLineEdit.Normal)
         if valid and not key.isEmpty():
             key = try_to_eval(unicode(key))
         else:
             return
     else:
         return
     value, valid = QInputDialog.getText(self,
               translate("DictEditor", 'Insert'),
               translate("DictEditor", 'Value:'),
               QLineEdit.Normal)
     if valid and not value.isEmpty():
         self.new_value(key, try_to_eval(unicode(value)))
开发者ID:cheesinglee,项目名称:spyder,代码行数:28,代码来源:dicteditor.py

示例5: start

 def start(self):
     filename = unicode(self.filecombo.currentText())
     
     self.process = QProcess(self)
     self.process.setProcessChannelMode(QProcess.SeparateChannels)
     self.process.setWorkingDirectory(osp.dirname(filename))
     self.connect(self.process, SIGNAL("readyReadStandardOutput()"),
                  self.read_output)
     self.connect(self.process, SIGNAL("readyReadStandardError()"),
                  lambda: self.read_output(error=True))
     self.connect(self.process, SIGNAL("finished(int,QProcess::ExitStatus)"),
                  self.finished)
     self.connect(self.stop_button, SIGNAL("clicked()"),
                  self.process.kill)
     
     self.output = ''
     self.error_output = ''
     p_args = [osp.basename(filename)]
     self.process.start(PYLINT_PATH, p_args)
     
     running = self.process.waitForStarted()
     self.set_running_state(running)
     if not running:
         QMessageBox.critical(self, translate('Pylint', "Error"),
                              translate('Pylint', "Process failed to start"))
开发者ID:Brainsciences,项目名称:luminoso,代码行数:25,代码来源:pylintgui.py

示例6: set_user_env

    def set_user_env(reg):
        """Set HKCU (current user) environment variables"""
        reg = listdict2envdict(reg)
        types = dict()
        key = OpenKey(HKEY_CURRENT_USER, "Environment")
        for name in reg:
            try:
                _, types[name] = QueryValueEx(key, name)
            except WindowsError:
                types[name] = REG_EXPAND_SZ
        key = OpenKey(HKEY_CURRENT_USER, "Environment", 0, KEY_SET_VALUE)
        for name in reg:
            SetValueEx(key, name, 0, types[name], reg[name])
        try:
            from win32gui import SendMessageTimeout
            from win32con import HWND_BROADCAST, WM_SETTINGCHANGE, SMTO_ABORTIFHUNG

            SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, "Environment", SMTO_ABORTIFHUNG, 5000)
        except ImportError:
            QMessageBox.warning(
                self,
                translate("WinUserEnvDialog", "Warning"),
                translate(
                    "WinUserEnvDialog",
                    "Module <b>pywin32 was not found</b>.<br>"
                    "Please restart this Windows <i>session</i> "
                    "(not the computer) for changes to take effect.",
                ),
            )
开发者ID:cheesinglee,项目名称:spyder,代码行数:29,代码来源:environ.py

示例7: start

 def start(self):
     self.datelabel.setText('Profiling, please wait...')
     filename = unicode(self.filecombo.currentText())
     
     self.process = QProcess(self)
     self.process.setProcessChannelMode(QProcess.SeparateChannels)
     self.process.setWorkingDirectory(os.path.dirname(filename))
     self.connect(self.process, SIGNAL("readyReadStandardOutput()"),
                  self.read_output)
     self.connect(self.process, SIGNAL("readyReadStandardError()"),
                  lambda: self.read_output(error=True))
     self.connect(self.process, SIGNAL("finished(int,QProcess::ExitStatus)"),
                  self.finished)
     self.connect(self.stop_button, SIGNAL("clicked()"),
                  self.process.kill)
     
     self.output = ''
     self.error_output = ''
     p_args = [os.path.basename(filename)]
     
     # FIXME: Use the system path to 'python' as opposed to hardwired
     p_args = ['-m', PROFILER_PATH, '-o', self.DATAPATH, os.path.basename(filename)]
     self.process.start('python', p_args)
     
     running = self.process.waitForStarted()
     self.set_running_state(running)
     if not running:
         QMessageBox.critical(self, translate('Profiler', "Error"),
                              translate('Profiler', "Process failed to start"))
开发者ID:sjara,项目名称:spyder-profiler,代码行数:29,代码来源:profilergui.py

示例8: __init__

    def __init__(self, parent):
        PluginWidget.__init__(self, parent)

        # Read-only editor
        self.editor = QsciEditor(self)
        self.editor.setup_editor(linenumbers=False, language='py',
                                 code_folding=True)
        self.connect(self.editor, SIGNAL("focus_changed()"),
                     lambda: self.emit(SIGNAL("focus_changed()")))
        self.editor.setReadOnly(True)
        self.editor.set_font( get_font(self.ID) )
        self.editor.toggle_wrap_mode( CONF.get(self.ID, 'wrap') )
        
        # Add entries to read-only editor context-menu
        font_action = create_action(self, translate("Editor", "&Font..."), None,
                                    'font.png',
                                    translate("Editor", "Set font style"),
                                    triggered=self.change_font)
        wrap_action = create_action(self, translate("Editor", "Wrap lines"),
                                    toggled=self.toggle_wrap_mode)
        wrap_action.setChecked( CONF.get(self.ID, 'wrap') )
        self.editor.readonly_menu.addSeparator()
        add_actions(self.editor.readonly_menu, (font_action, wrap_action))
        
        # Find/replace widget
        self.find_widget = FindReplace(self)
        self.find_widget.set_editor(self.editor)
        self.find_widget.hide()
开发者ID:Brainsciences,项目名称:luminoso,代码行数:28,代码来源:__init__.py

示例9: _set_step

 def _set_step(self,step):
     """Proceed to a given step"""
     new_tab = self.tab_widget.currentIndex() + step
     assert new_tab < self.tab_widget.count() and new_tab >= 0
     if new_tab == self.tab_widget.count()-1:
         try:
             self.table_widget.open_data(self._get_plain_text(),
                                     self.text_widget.get_col_sep(),
                                     self.text_widget.get_row_sep(),
                                     self.text_widget.trnsp_box.isChecked(),
                                     self.text_widget.get_skiprows(),
                                     self.text_widget.get_comments())
             self.done_btn.setEnabled(True)
             self.done_btn.setDefault(True)
             self.fwd_btn.setEnabled(False)
             self.back_btn.setEnabled(True)
         except (SyntaxError, AssertionError), error:
             QMessageBox.critical(self,
                         translate("ImportWizard", "Import wizard"),
                         translate("ImportWizard",
                                   "<b>Unable to proceed to next step</b>"
                                   "<br><br>Please check your entries."
                                   "<br><br>Error message:<br>%2") \
                         .arg(str(error)))
             return
开发者ID:cheesinglee,项目名称:spyder,代码行数:25,代码来源:importwizard.py

示例10: __init__

    def __init__(self, parent, data, readonly=False, title="",
                 names=False, truncate=True, minmax=False,
                 inplace=False, collvalue=True):
        BaseTableView.__init__(self, parent)
        self.dictfilter = None
        self.readonly = readonly or isinstance(data, tuple)
        self.model = None
        self.delegate = None
        DictModelClass = ReadOnlyDictModel if self.readonly else DictModel
        self.model = DictModelClass(self, data, title, names=names,
                                    truncate=truncate, minmax=minmax,
                                    collvalue=collvalue)
        self.setModel(self.model)
        self.delegate = DictDelegate(self, inplace=inplace)
        self.setItemDelegate(self.delegate)

        self.setup_table()
        self.menu = self.setup_menu(truncate, minmax, inplace, collvalue)
        self.copy_action = create_action(self,
                                      translate("DictEditor", "Copy"),
                                      icon=get_icon('editcopy.png'),
                                      triggered=self.copy)                                      
        self.paste_action = create_action(self,
                                      translate("DictEditor", "Paste"),
                                      icon=get_icon('editpaste.png'),
                                      triggered=self.paste)
        self.menu.insertAction(self.remove_action, self.copy_action)
        self.menu.insertAction(self.remove_action, self.paste_action)
        
        self.empty_ws_menu = QMenu(self)
        self.empty_ws_menu.addAction(self.paste_action)
开发者ID:Brainsciences,项目名称:luminoso,代码行数:31,代码来源:dicteditor.py

示例11: select_file

 def select_file(self):
     self.emit(SIGNAL('redirect_stdio(bool)'), False)
     filename = QFileDialog.getOpenFileName(self,
                   translate('Pylint', "Select Python script"), os.getcwdu(),
                   translate('Pylint', "Python scripts")+" (*.py ; *.pyw)")
     self.emit(SIGNAL('redirect_stdio(bool)'), False)
     if filename:
         self.analyze(filename)
开发者ID:Brainsciences,项目名称:luminoso,代码行数:8,代码来源:pylintgui.py

示例12: get_plugin_actions

 def get_plugin_actions(self):
     """Setup actions"""
     # Font
     font_action = create_action(self, translate('Explorer', "&Font..."),
                                 None, 'font.png',
                                 translate("Explorer", "Set font style"),
                                 triggered=self.change_font)
     self.treewidget.common_actions.append(font_action)
     return (None, None)
开发者ID:cheesinglee,项目名称:spyder,代码行数:9,代码来源:explorer.py

示例13: __prepare_plot

 def __prepare_plot(self):
     try:
         from matplotlib import rcParams
         rcParams['backend'] = 'Qt4agg'
         return True
     except ImportError:
         QMessageBox.warning(self, translate("DictEditor", "Import error"),
                 translate("DictEditor",
                           "Please install <b>matplotlib</b>."))
开发者ID:Brainsciences,项目名称:luminoso,代码行数:9,代码来源:dicteditor.py

示例14: get_arguments

 def get_arguments(self):
     arguments, valid = QInputDialog.getText(self,
                               translate('ExternalShellBase', 'Arguments'),
                               translate('ExternalShellBase',
                                         'Command line arguments:'),
                               QLineEdit.Normal, self.arguments)
     if valid:
         self.arguments = unicode(arguments)
     return valid
开发者ID:cheesinglee,项目名称:spyder,代码行数:9,代码来源:__init__.py

示例15: __prepare_plot

 def __prepare_plot(self):
     try:
         from spyderlib import mpl_patch
         mpl_patch.set_backend("Qt4Agg")
         mpl_patch.apply()
         return True
     except ImportError:
         QMessageBox.warning(self, translate("DictEditor", "Import error"),
                 translate("DictEditor",
                           "Please install <b>matplotlib</b>."))
开发者ID:cheesinglee,项目名称:spyder,代码行数:10,代码来源:dicteditor.py


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