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

Python QtGui.QMessageBox类代码示例

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

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



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

示例1: load_and_translate

 def load_and_translate(self, combine, pythonfile, editor, set_current=True):
     """
     Read filename as combine archive, unzip, translate, reconstitute in 
     Python, and create an editor instance and return it
     *Warning* This is loading file, creating editor but not executing
     the source code analysis -- the analysis must be done by the editor
     plugin (in case multiple editorstack instances are handled)
     """
     combine = str(combine)
     self.emit(SIGNAL('starting_long_process(QString)'),
               _("Loading %s...") % combine)
     text, enc = encoding.read(combine)
     text = Translatecombine(combine)
     zipextloctemp, sbmlloclisttemp, sedmlloclisttemp = manifestsearch(combine)
     for i in range(len(text)):
         widgeteditor = editor.editorstacks[0]
         sedmlfname = os.path.basename(sedmlloclisttemp[i])
         finfo = widgeteditor.create_new_editor(os.path.splitext(sedmlfname)[0] + '_phrasedml.py', enc, text[i], set_current, new=True)
         index = widgeteditor.data.index(finfo)
         widgeteditor._refresh_outlineexplorer(index, update=True)
         self.emit(SIGNAL('ending_long_process(QString)'), "")
         if widgeteditor.isVisible() and widgeteditor.checkeolchars_enabled \
          and sourcecode.has_mixed_eol_chars(text[i]):
             name = os.path.basename(pythonfile[:-3] + '_phrasedml.py')
             QMessageBox.warning(self, widgeteditor.title,
                                 _("<b>%s</b> contains mixed end-of-line "
                                   "characters.<br>Spyder will fix this "
                                   "automatically.") % name,
                                 QMessageBox.Ok)
             widgeteditor.set_os_eol_chars(index)
         widgeteditor.is_analysis_done = False
         finfo.editor.set_cursor_position('eof')
         finfo.editor.insert_text(os.linesep)
     return finfo, combine
开发者ID:kirichoi,项目名称:spyderplugins,代码行数:34,代码来源:p_import_combine_phrasedml.py


示例2: chdir

 def chdir(self, directory=None, browsing_history=False):
     """Set directory as working directory"""
     if directory is not None:
         directory = osp.abspath(to_text_string(directory))
     if browsing_history:
         directory = self.history[self.histindex]
     elif directory in self.history:
         self.histindex = self.history.index(directory)
     else:
         if self.histindex is None:
             self.history = []
         else:
             self.history = self.history[: self.histindex + 1]
         if len(self.history) == 0 or (self.history and self.history[-1] != directory):
             self.history.append(directory)
         self.histindex = len(self.history) - 1
     directory = to_text_string(directory)
     if PY2:
         PermissionError = OSError
     try:
         os.chdir(directory)
         self.parent_widget.open_dir.emit(directory)
         self.refresh(new_path=directory, force_current=True)
     except PermissionError:
         QMessageBox.critical(
             self.parent_widget, "Error", _("You don't have the right permissions to " "open this directory")
         )
开发者ID:sonofeft,项目名称:spyder,代码行数:27,代码来源:explorer.py


示例3: load_and_translate

 def load_and_translate(self, sedmlfile, pythonfile, editor, set_current=True):
     """
     Read filename as SED-ML file, translate it to Python, and
     create an editor instance and return it
     *Warning* This is loading file, creating editor but not executing
     the source code analysis -- the analysis must be done by the editor
     plugin (in case multiple editorstack instances are handled)
     """
     #sedmlfile = to_text_string(sedmlfile)
     sedmlfile = str(sedmlfile)
     self.emit(SIGNAL('starting_long_process(QString)'),
               _("Loading %s...") % sedmlfile)
     text, enc = encoding.read(sedmlfile)
     fname = os.path.basename(sedmlfile)
     temp =  '"End of code generated by Import SED-ML plugin ' + time.strftime("%m/%d/%Y") + '"\n"Extracted from ' + fname + '"\n\n'
     text = te.sedmlToPython(sedmlfile) + temp
     widgeteditor = editor.editorstacks[0]
     finfo = widgeteditor.create_new_editor(pythonfile, enc, text, set_current, new=True)
     index = widgeteditor.data.index(finfo)
     widgeteditor._refresh_outlineexplorer(index, update=True)
     self.emit(SIGNAL('ending_long_process(QString)'), "")
     if widgeteditor.isVisible() and widgeteditor.checkeolchars_enabled \
        and sourcecode.has_mixed_eol_chars(text):
         name = os.path.basename(pythonfile)
         QMessageBox.warning(self, widgeteditor.title,
                             _("<b>%s</b> contains mixed end-of-line "
                               "characters.<br>Spyder will fix this "
                               "automatically.") % name,
                             QMessageBox.Ok)
         widgeteditor.set_os_eol_chars(index)
     widgeteditor.is_analysis_done = False
     finfo.editor.set_cursor_position('eof')
     finfo.editor.insert_text(os.linesep)
     return finfo, sedmlfile
开发者ID:sys-bio,项目名称:spyderplugins,代码行数:34,代码来源:p_import_sedml.py


示例4: _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) as error:
             QMessageBox.critical(
                 self,
                 _("Import wizard"),
                 _(
                     "<b>Unable to proceed to next step</b>"
                     "<br><br>Please check your entries."
                     "<br><br>Error message:<br>%s"
                 )
                 % str(error),
             )
             return
     elif new_tab == 0:
         self.done_btn.setEnabled(False)
         self.fwd_btn.setEnabled(True)
         self.back_btn.setEnabled(False)
     self._focus_tab(new_tab)
开发者ID:gyenney,项目名称:Tools,代码行数:35,代码来源:importwizard.py


示例5: _sel_to_text

 def _sel_to_text(self, cell_range):
     """Copy an array portion to a unicode string"""
     if not cell_range:
         return
     row_min, row_max, col_min, col_max = get_idx_rect(cell_range)
     if col_min == 0 and col_max == (self.model().cols_loaded-1):
         # we've selected a whole column. It isn't possible to
         # select only the first part of a column without loading more, 
         # so we can treat it as intentional and copy the whole thing
         col_max = self.model().total_cols-1
     if row_min == 0 and row_max == (self.model().rows_loaded-1):
         row_max = self.model().total_rows-1
     
     _data = self.model().get_data()
     if PY3:
         output = io.BytesIO()
     else:
         output = io.StringIO()
     try:
         np.savetxt(output, _data[row_min:row_max+1, col_min:col_max+1],
                    delimiter='\t')
     except:
         QMessageBox.warning(self, _("Warning"),
                             _("It was not possible to copy values for "
                               "this array"))
         return
     contents = output.getvalue().decode('utf-8')
     output.close()
     return contents
开发者ID:AungWinnHtut,项目名称:spyder,代码行数:29,代码来源:arrayeditor.py


示例6: set_user_env

 def set_user_env(reg, parent=None):
     """Set HKCU (current user) environment variables"""
     reg = listdict2envdict(reg)
     types = dict()
     key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, "Environment")
     for name in reg:
         try:
             _x, types[name] = winreg.QueryValueEx(key, name)
         except WindowsError:
             types[name] = winreg.REG_EXPAND_SZ
     key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, "Environment", 0,
                          winreg.KEY_SET_VALUE)
     for name in reg:
         winreg.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(parent, _("Warning"),
                     _("Module <b>pywin32 was not found</b>.<br>"
                       "Please restart this Windows <i>session</i> "
                       "(not the computer) for changes to take effect."))
开发者ID:jayitb,项目名称:Spyderplugin_ratelaws,代码行数:25,代码来源:environ.py


示例7: setData

 def setData(self, index, value, role=Qt.EditRole):
     """Cell content change"""
     if not index.isValid() or self.readonly:
         return False
     i = index.row()
     j = index.column()
     value = from_qvariant(value, str)
     if self._data.dtype.name == "bool":
         try:
             val = bool(float(value))
         except ValueError:
             val = value.lower() == "true"
     elif self._data.dtype.name.startswith("string"):
         val = str(value)
     elif self._data.dtype.name.startswith("unicode"):
         val = unicode(value)
     else:
         if value.lower().startswith('e') or value.lower().endswith('e'):
             return False
         try:
             val = complex(value)
             if not val.imag:
                 val = val.real
         except ValueError, e:
             QMessageBox.critical(self.dialog, "Error",
                                  "Value error: %s" % str(e))
             return False
开发者ID:jromang,项目名称:retina-old,代码行数:27,代码来源:arrayeditor.py


示例8: save_data

 def save_data(self, filename=None):
     """Save data"""
     if filename is None:
         filename = self.filename
         if filename is None:
             filename = getcwd()
         filename, _selfilter = getsavefilename(self, _("Save data"),
                                                filename,
                                                iofunctions.save_filters)
         if filename:
             self.filename = filename
         else:
             return False
     QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
     QApplication.processEvents()
     if self.is_internal_shell:
         wsfilter = self.get_internal_shell_filter('picklable',
                                                   check_all=True)
         namespace = wsfilter(self.shellwidget.interpreter.namespace).copy()
         error_message = iofunctions.save(namespace, filename)
     else:
         settings = self.get_view_settings()
         error_message = monitor_save_globals(self._get_sock(),
                                              settings, filename)
     QApplication.restoreOverrideCursor()
     QApplication.processEvents()
     if error_message is not None:
         QMessageBox.critical(self, _("Save data"),
                         _("<b>Unable to save current workspace</b>"
                           "<br><br>Error message:<br>%s") % error_message)
     self.save_button.setEnabled(self.filename is not None)
开发者ID:ImadBouirmane,项目名称:spyder,代码行数:31,代码来源:namespacebrowser.py


示例9: start

 def start(self):
     filename = to_text_string(self.filecombo.currentText())
     
     self.process = QProcess(self)
     self.process.setProcessChannelMode(QProcess.SeparateChannels)
     self.process.setWorkingDirectory(osp.dirname(filename))
     self.process.readyReadStandardOutput.connect(self.read_output)
     self.process.readyReadStandardError.connect(
                                       lambda: self.read_output(error=True))
     self.process.finished.connect(lambda ec, es=QProcess.ExitStatus:
                                   self.finished(ec, es))
     self.stop_button.clicked.connect(self.process.kill)
     
     self.output = ''
     self.error_output = ''
     
     plver = PYLINT_VER
     if plver is not None:
         if plver.split('.')[0] == '0':
             p_args = ['-i', 'yes']
         else:
             # Option '-i' (alias for '--include-ids') was removed in pylint
             # 1.0
             p_args = ["--msg-template='{msg_id}:{line:3d},"\
                       "{column}: {obj}: {msg}"]
         p_args += [osp.basename(filename)]
     else:
         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, _("Error"),
                              _("Process failed to start"))
开发者ID:gyenney,项目名称:Tools,代码行数:35,代码来源:pylintgui.py


示例10: delete_file

 def delete_file(self, fname, multiple, yes_to_all):
     """Delete file"""
     if multiple:
         buttons = QMessageBox.Yes | QMessageBox.YesAll | QMessageBox.No | QMessageBox.Cancel
     else:
         buttons = QMessageBox.Yes | QMessageBox.No
     if yes_to_all is None:
         answer = QMessageBox.warning(
             self, _("Delete"), _("Do you really want " "to delete <b>%s</b>?") % osp.basename(fname), buttons
         )
         if answer == QMessageBox.No:
             return yes_to_all
         elif answer == QMessageBox.Cancel:
             return False
         elif answer == QMessageBox.YesAll:
             yes_to_all = True
     try:
         if osp.isfile(fname):
             misc.remove_file(fname)
             self.parent_widget.removed.emit(fname)
         else:
             self.remove_tree(fname)
             self.parent_widget.removed_tree.emit(fname)
         return yes_to_all
     except EnvironmentError as error:
         action_str = _("delete")
         QMessageBox.critical(
             self,
             _("Project Explorer"),
             _("<b>Unable to %s <i>%s</i></b>" "<br><br>Error message:<br>%s")
             % (action_str, fname, to_text_string(error)),
         )
     return False
开发者ID:sonofeft,项目名称:spyder,代码行数:33,代码来源:explorer.py


示例11: help

 def help(self):
     """Help on Spyder console"""
     QMessageBox.about(
         self,
         _("Help"),
         """<b>%s</b>
                       <p><i>%s</i><br>    edit foobar.py
                       <p><i>%s</i><br>    xedit foobar.py
                       <p><i>%s</i><br>    run foobar.py
                       <p><i>%s</i><br>    clear x, y
                       <p><i>%s</i><br>    !ls
                       <p><i>%s</i><br>    object?
                       <p><i>%s</i><br>    result = oedit(object)
                       """
         % (
             _("Shell special commands:"),
             _("Internal editor:"),
             _("External editor:"),
             _("Run script:"),
             _("Remove references:"),
             _("System commands:"),
             _("Python help:"),
             _("GUI-based editor:"),
         ),
     )
开发者ID:dimikara,项目名称:spyder,代码行数:25,代码来源:internalshell.py


示例12: rename_file

 def rename_file(self, fname):
     """Rename file"""
     path, valid = QInputDialog.getText(self, _("Rename"), _("New name:"), QLineEdit.Normal, osp.basename(fname))
     if valid:
         path = osp.join(osp.dirname(fname), to_text_string(path))
         if path == fname:
             return
         if osp.exists(path):
             if (
                 QMessageBox.warning(
                     self,
                     _("Rename"),
                     _("Do you really want to rename <b>%s</b> and " "overwrite the existing file <b>%s</b>?")
                     % (osp.basename(fname), osp.basename(path)),
                     QMessageBox.Yes | QMessageBox.No,
                 )
                 == QMessageBox.No
             ):
                 return
         try:
             misc.rename_file(fname, path)
             self.parent_widget.renamed.emit(fname, path)
             return path
         except EnvironmentError as error:
             QMessageBox.critical(
                 self,
                 _("Rename"),
                 _("<b>Unable to rename file <i>%s</i></b>" "<br><br>Error message:<br>%s")
                 % (osp.basename(fname), to_text_string(error)),
             )
开发者ID:sonofeft,项目名称:spyder,代码行数:30,代码来源:explorer.py


示例13: load_and_translate

 def load_and_translate(self, sbmlfile, pythonfile, editor, set_current=True):
     """
     Read filename as combine archive, unzip, translate, reconstitute in 
     Python, and create an editor instance and return it
     *Warning* This is loading file, creating editor but not executing
     the source code analysis -- the analysis must be done by the editor
     plugin (in case multiple editorstack instances are handled)
     """
     sbmlfile = str(sbmlfile)
     self.emit(SIGNAL('starting_long_process(QString)'),
               _("Loading %s...") % sbmlfile)
     text, enc = encoding.read(sbmlfile)
     sbmlstr = te.readFromFile(sbmlfile)
     text = "import tellurium as te\n\nr = te.loada('''\n" + str(te.sbmlToAntimony(sbmlstr)) + "''')"
     widgeteditor = editor.editorstacks[0]
     finfo = widgeteditor.create_new_editor(pythonfile, enc, text, set_current, new=True)
     index = widgeteditor.data.index(finfo)
     widgeteditor._refresh_outlineexplorer(index, update=True)
     self.emit(SIGNAL('ending_long_process(QString)'), "")
     if widgeteditor.isVisible() and widgeteditor.checkeolchars_enabled \
      and sourcecode.has_mixed_eol_chars(text):
         name = os.path.basename(pythonfile)
         QMessageBox.warning(self, widgeteditor.title,
                             _("<b>%s</b> contains mixed end-of-line "
                               "characters.<br>Spyder will fix this "
                               "automatically.") % name,
                             QMessageBox.Ok)
         widgeteditor.set_os_eol_chars(index)
     widgeteditor.is_analysis_done = False
     finfo.editor.set_cursor_position('eof')
     finfo.editor.insert_text(os.linesep)
     return finfo, sbmlfile
开发者ID:sys-bio,项目名称:spyderplugins,代码行数:32,代码来源:p_opensbml.py


示例14: run_script_in_current_client

 def run_script_in_current_client(self, filename, wdir, args, debug):
     """Run script in current client, if any"""
     norm = lambda text: remove_backslashes(to_text_string(text))
     client = self.get_current_client()
     if client is not None:
         # Internal kernels, use runfile
         if client.kernel_widget_id is not None:
             line = "%s('%s'" % ('debugfile' if debug else 'runfile',
                                 norm(filename))
             if args:
                 line += ", args='%s'" % norm(args)
             if wdir:
                 line += ", wdir='%s'" % norm(wdir)
             line += ")"
         else: # External kernels, use %run
             line = "%run "
             if debug:
                 line += "-d "
             line += "\"%s\"" % to_text_string(filename)
             if args:
                 line += " %s" % norm(args)
         self.execute_python_code(line)
         self.visibility_changed(True)
         self.raise_()
     else:
         #XXX: not sure it can really happen
         QMessageBox.warning(self, _('Warning'),
             _("No IPython console is currently available to run <b>%s</b>."
               "<br><br>Please open a new one and try again."
               ) % osp.basename(filename), QMessageBox.Ok)
开发者ID:Poneyo,项目名称:spyderlib,代码行数:30,代码来源:ipythonconsole.py


示例15: start

    def start(self, wdir=None, args=None, pythonpath=None):
        filename = to_text_string(self.filecombo.currentText())
        if wdir is None:
            wdir = self._last_wdir
            if wdir is None:
                wdir = osp.basename(filename)
        if args is None:
            args = self._last_args
            if args is None:
                args = []
        if pythonpath is None:
            pythonpath = self._last_pythonpath
        self._last_wdir = wdir
        self._last_args = args
        self._last_pythonpath = pythonpath
        
        self.datelabel.setText(_('Profiling, please wait...'))
        
        self.process = QProcess(self)
        self.process.setProcessChannelMode(QProcess.SeparateChannels)
        self.process.setWorkingDirectory(wdir)
        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)

        if pythonpath is not None:
            env = [to_text_string(_pth)
                   for _pth in self.process.systemEnvironment()]
            baseshell.add_pathlist_to_PYTHONPATH(env, pythonpath)
            self.process.setEnvironment(env)
        
        self.output = ''
        self.error_output = ''
        
        p_args = ['-m', 'cProfile', '-o', self.DATAPATH]
        if os.name == 'nt':
            # On Windows, one has to replace backslashes by slashes to avoid 
            # confusion with escape characters (otherwise, for example, '\t' 
            # will be interpreted as a tabulation):
            p_args.append(osp.normpath(filename).replace(os.sep, '/'))
        else:
            p_args.append(filename)
        if args:
            p_args.extend(shell_split(args))
        executable = sys.executable
        if executable.endswith("spyder.exe"):
            # py2exe distribution
            executable = "python.exe"
        self.process.start(executable, p_args)
        
        running = self.process.waitForStarted()
        self.set_running_state(running)
        if not running:
            QMessageBox.critical(self, _("Error"),
                                 _("Process failed to start"))
开发者ID:alfonsodiecko,项目名称:PYTHON_DIST,代码行数:60,代码来源:profilergui.py


示例16: move

 def move(self, fnames=None):
     """Move files/directories"""
     if fnames is None:
         fnames = self.get_selected_filenames()
     orig = fixpath(osp.dirname(fnames[0]))
     while True:
         self.parent_widget.redirect_stdio.emit(False)
         folder = getexistingdirectory(self, _("Select directory"), orig)
         self.parent_widget.redirect_stdio.emit(True)
         if folder:
             folder = fixpath(folder)
             if folder != orig:
                 break
         else:
             return
     for fname in fnames:
         basename = osp.basename(fname)
         try:
             misc.move_file(fname, osp.join(folder, basename))
         except EnvironmentError as error:
             QMessageBox.critical(
                 self,
                 _("Error"),
                 _("<b>Unable to move <i>%s</i></b>" "<br><br>Error message:<br>%s")
                 % (basename, to_text_string(error)),
             )
开发者ID:sonofeft,项目名称:spyder,代码行数:26,代码来源:explorer.py


示例17: launch_error_message

    def launch_error_message(self, error_type, error=None):
        """Launch a message box with a predefined error message.

        Parameters
        ----------
        error_type : int [CLOSE_ERROR, RESET_ERROR, RESTART_ERROR]
            Possible error codes when restarting/reseting spyder.
        error : Exception
            Actual Python exception error caught.
        """
        messages = {CLOSE_ERROR: _("It was not possible to close the previous "
                                   "Spyder instance.\nRestart aborted."),
                    RESET_ERROR: _("Spyder could not reset to factory "
                                   "defaults.\nRestart aborted."),
                    RESTART_ERROR: _("It was not possible to restart Spyder.\n"
                                     "Operation aborted.")}
        titles = {CLOSE_ERROR: _("Spyder exit error"),
                  RESET_ERROR: _("Spyder reset error"),
                  RESTART_ERROR: _("Spyder restart error")}

        if error:
            e = error.__repr__()
            message = messages[error_type] + _("\n\n{0}").format(e)
        else:
            message = messages[error_type]

        title = titles[error_type]
        self.splash.hide()
        QMessageBox.warning(self, title, message, QMessageBox.Ok)
        raise RuntimeError(message)
开发者ID:AminJamalzadeh,项目名称:spyder,代码行数:30,代码来源:restart.py


示例18: create_new_folder

 def create_new_folder(self, current_path, title, subtitle, is_package):
     """Create new folder"""
     if current_path is None:
         current_path = ""
     if osp.isfile(current_path):
         current_path = osp.dirname(current_path)
     name, valid = QInputDialog.getText(self, title, subtitle, QLineEdit.Normal, "")
     if valid:
         dirname = osp.join(current_path, to_text_string(name))
         try:
             os.mkdir(dirname)
         except EnvironmentError as error:
             QMessageBox.critical(
                 self,
                 title,
                 _("<b>Unable " "to create folder <i>%s</i></b>" "<br><br>Error message:<br>%s")
                 % (dirname, to_text_string(error)),
             )
         finally:
             if is_package:
                 fname = osp.join(dirname, "__init__.py")
                 try:
                     with open(fname, "wb") as f:
                         f.write(to_binary_string("#"))
                     return dirname
                 except EnvironmentError as error:
                     QMessageBox.critical(
                         self,
                         title,
                         _("<b>Unable " "to create file <i>%s</i></b>" "<br><br>Error message:<br>%s")
                         % (fname, to_text_string(error)),
                     )
开发者ID:sonofeft,项目名称:spyder,代码行数:32,代码来源:explorer.py


示例19: setData

    def setData(self, index, value, role=Qt.EditRole, change_type=None):
        """Cell content change"""
        column = index.column()
        row = index.row()

        if change_type is not None:
            try:
                value = self.data(index, role=Qt.DisplayRole)
                val = from_qvariant(value, str)
                if change_type is bool:
                    val = bool_false_check(val)
                self.df.iloc[row, column - 1] = change_type(val)
            except ValueError:
                self.df.iloc[row, column - 1] = change_type('0')
        else:
            val = from_qvariant(value, str)
            current_value = self.get_value(row, column-1)
            if isinstance(current_value, bool):
                val = bool_false_check(val)
            if isinstance(current_value, ((bool,) + _sup_nr + _sup_com)) or \
               is_text_string(current_value):
                try:
                    self.df.iloc[row, column-1] = current_value.__class__(val)
                except ValueError as e:
                    QMessageBox.critical(self.dialog, "Error",
                                         "Value error: %s" % str(e))
                    return False
            else:
                QMessageBox.critical(self.dialog, "Error",
                                     "The type of the cell is not a supported "
                                     "type")
                return False
        self.max_min_col_update()
        return True
开发者ID:gyenney,项目名称:Tools,代码行数:34,代码来源:dataframeeditor.py


示例20: finished

 def finished(self, exit_code, exit_status):
     self.set_running_state(False)
     if not self.output:
         if self.error_output:
             QMessageBox.critical(self, _("Error"), self.error_output)
             print("pylint error:\n\n" + self.error_output, file=sys.stderr)
         return
     
     # Convention, Refactor, Warning, Error
     results = {'C:': [], 'R:': [], 'W:': [], 'E:': []}
     txt_module = '************* Module '
     
     module = '' # Should not be needed - just in case something goes wrong
     for line in self.output.splitlines():
         if line.startswith(txt_module):
             # New module
             module = line[len(txt_module):]
             continue
         # Supporting option include-ids: ('R3873:' instead of 'R:')
         if not re.match('^[CRWE]+([0-9]{4})?:', line):
             continue
         i1 = line.find(':')
         if i1 == -1:
             continue
         msg_id = line[:i1]
         i2 = line.find(':', i1+1)
         if i2 == -1:
             continue
         line_nb = line[i1+1:i2].strip()
         if not line_nb:
             continue
         line_nb = int(line_nb.split(',')[0])
         message = line[i2+1:]
         item = (module, line_nb, message, msg_id)
         results[line[0]+':'].append(item)
         
     # Rate
     rate = None
     txt_rate = 'Your code has been rated at '
     i_rate = self.output.find(txt_rate)
     if i_rate > 0:
         i_rate_end = self.output.find('/10', i_rate)
         if i_rate_end > 0:
             rate = self.output[i_rate+len(txt_rate):i_rate_end]
     
     # Previous run
     previous = ''
     if rate is not None:
         txt_prun = 'previous run: '
         i_prun = self.output.find(txt_prun, i_rate_end)
         if i_prun > 0:
             i_prun_end = self.output.find('/10', i_prun)
             previous = self.output[i_prun+len(txt_prun):i_prun_end]
         
     
     filename = to_text_string(self.filecombo.currentText())
     self.set_data(filename, (time.localtime(), rate, previous, results))
     self.output = self.error_output + self.output
     self.show_data(justanalyzed=True)
开发者ID:gyenney,项目名称:Tools,代码行数:59,代码来源:pylintgui.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python QtGui.QPushButton类代码示例发布时间:2022-05-27
下一篇:
Python QtGui.QMenu类代码示例发布时间: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