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


Python message_box.MessageBox类代码示例

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


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

示例1: execBatch

    def execBatch(self):
        ''' Present a dialog to execute a set of tool configurations '''
        assert self.has_selected_item()
        # Node representing the set to execute
        tool_set_node = self.selected_item().node

        # map tool config nodes in set -> name of the hooked node
        tool_config_to_tool_name = {}
        tool_config_nodes = tool_set_node[:]
        for tool_config_node in tool_config_nodes:
            hook_node = tool_config_node.find('tool_hook')
            hooked_tool_name = str(hook_node.text or '').strip()
            hooked_tool_node = get_tool_node_by_name(self.project, hooked_tool_name)
            module_name = hooked_tool_node.find('class_module').text
            
            try:
                module_name = hooked_tool_node.find('class_module').text
                tool_path = get_path_to_tool_modules(self.project)
                import_path = tool_path + '.' + module_name
                importString = "from %s import opusRun" % (import_path)
                exec(importString)
                tool_config_to_tool_name[tool_config_node] = import_path
            except Exception, e:
                MessageBox.error(mainwindow = self.view,
                    text = 'Invalid module name',
                    detailed_text = ('This tool points to a module named "%s", ' % import_path + \
                                     'but there is no module with that name, or module returned import error: %s. ' \
                                     % formatExceptionInfo() 
                                     ))
                return
开发者ID:apdjustino,项目名称:DRCOG_Urbansim,代码行数:30,代码来源:xml_controller_data_tools.py

示例2: execToolConfig

    def execToolConfig(self):
        '''
        Show the dialog box for executing a "tool config"
        A tool config is has a pointer to an existing tool (a "tool hook") but
        can provide an alternative configuration.
        '''
        assert self.has_selected_item()

        # First we need to get the hooked node that we want to run
        node = self.selected_item().node
        hooked_tool_name = node.find('tool_hook').text
        hooked_tool_node = get_tool_node_by_name(self.project, hooked_tool_name)
        if hooked_tool_node is None:
            MessageBox.error(mainwindow = self.view,
                text = 'Invalid tool hook',
                detailed_text = ('This tool config points to a tool named "%s" '
                    'but there is no tool with that name in this project.' %
                    hooked_tool_name))
            return

        # Open up a GUI element and populate with variable's
        tool_lib_node = get_tool_library_node(self.project)
        params = {'tool_path': get_path_to_tool_modules(self.project)}
        window = ExecuteToolGui(parent_widget = self.manager.base_widget,
                                tool_node = hooked_tool_node,
                                tool_config = node,
                                tool_library_node = tool_lib_node,
                                params=params,
                                model=self.model)
        window.setModal(True)
        window.show()
开发者ID:apdjustino,项目名称:DRCOG_Urbansim,代码行数:31,代码来源:xml_controller_data_tools.py

示例3: execToolFile

    def execToolFile(self):
        '''
        Show a dialog box that lets the user configure and execute a
        tool.
        '''
        assert self.has_selected_item()

        tool_lib_node = get_tool_library_node(self.project)
        params = {'tool_path': get_path_to_tool_modules(self.project)}

        tool_node = self.selected_item().node

        try:
            module_name = tool_node.find('class_module').text
            import_path = params['tool_path'] + '.' + module_name
            importString = "from %s import opusRun" % (import_path)
            exec(importString)
        except Exception, e:
            print e
            MessageBox.error(mainwindow = self.view,
                text = 'Invalid module name',
                detailed_text = ('This tool points to a module named "%s", ' % import_path + \
                                 'but there is no module with that name, or module returned import error: %s. ' \
                                 % formatExceptionInfo() 
                                 ))
            return
开发者ID:apdjustino,项目名称:DRCOG_Urbansim,代码行数:26,代码来源:xml_controller_data_tools.py

示例4: execToolFile

    def execToolFile(self):
        """
        Show a dialog box that lets the user configure and execute a
        tool.
        """
        assert self.has_selected_item()

        tool_lib_node = get_tool_library_node(self.project)
        params = {"tool_path": get_path_to_tool_modules(self.project)}

        tool_node = self.selected_item().node

        try:
            module_name = tool_node.find("class_module").text
            import_path = params["tool_path"] + "." + module_name
            importString = "from %s import opusRun" % (import_path)
            exec (importString)
        except Exception, e:
            print e
            MessageBox.error(
                mainwindow=self.view,
                text="Invalid module name",
                detailed_text=(
                    'This tool points to a module named "%s" '
                    "but there is no module with that name, or module returned import error." % import_path
                ),
            )
            return
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:28,代码来源:xml_controller_data_tools.py

示例5: addParam

    def addParam(self):
        assert self.has_selected_item()

        item = self.selected_item()
        node = item.node
        window = addParamGui(self.manager.base_widget, None)
        window.setModal(True)
        window.show()

        if window.exec_() == window.Accepted:
            name = str(window.nameEdit.text())
            typ = str(window.typeComboBox.currentText())
            default = str(window.defaultEdit.text())
            required = str(window.requiredComboBox.currentText())

            attributes = {'name': name, 'param_type': typ, 'required': required}
            node = Element('param', attributes)
            node.text = default
            if self.model.insertRow(0, self.selected_index(), node) == False:
                MessageBox.error(mainwindow = self.view,
                    text = 'Parameter Name Exists',
                    detailed_text = ('The parameter name to add is "%s" '
                    'but there is already a parameter with that name.' %
                    name))
                return

            self.view.expand(self.selected_index())
开发者ID:apdjustino,项目名称:DRCOG_Urbansim,代码行数:27,代码来源:xml_controller_data_tools.py

示例6: runErrorFromThread

 def runErrorFromThread(self,errorMessage):
     self.running = False
     self.paused = False
     self.pbnStartModel.setText(QString("Start Simulation Run..."))
     MessageBox.warning(mainwindow = self.mainwindow,
                       text = "There was a problem running the simulation.",
                       detailed_text = errorMessage)
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:7,代码来源:simulation_gui_element.py

示例7: on_buttonBox_accepted

    def on_buttonBox_accepted(self):
        viz_params = self._get_viz_spec()

        if viz_params is None:
            self.close()
            return

        dataset_name = viz_params['dataset_name']
        viz_type = viz_params['visualization_type']

        close = True
        if (viz_type == 'mapnik_map' or viz_type == 'mapnik_animated_map') and dataset_name not in self.spatial_datasets:
            MessageBox.warning(mainwindow = self.mainwindow,
                      text = "That indicator cannot be visualized as a map.",
                      detailed_text = ('The dataset %s is either not spatial or cannot be '
                                       'rendered as a grid. If the latter, please try '
                                       'exporting to an external GIS tool.'%dataset_name))
            close = False

        else:
            self._update_xml_from_dict(self.base_node, viz_params)
            update_batch_indicator_visualization(self.base_node)

        if close:
            self.close()
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:25,代码来源:configure_existing_batch_indicator_visualization.py

示例8: delete_run

 def delete_run(self, run_node, force=False):
     '''
     Remove a run both from the services database and from the model.
     @param run_node (Element): the node to remove.
     '''
     # Prevent the user from removing base years
     cache_directory = run_node.find('cache_directory').text
     if cache_directory.endswith('base_year_data') and not force:
         msg = ('Removing the base year data directory is restricted from '
                'within OpusGUI since doing so will make it impossible to '
                'run any simulations or estimations.')
         MessageBox.warning(mainwindow = self.view,
                            text = 'Cannot remove base year data',
                            detailed_text  = msg)
         return
     try:
         run_manager = get_run_manager()
         run_id = run_node.get('run_id')
         try:
             run_id = int(run_id)
         except:
             run_id = -1
         run_manager.delete_everything_for_this_run(run_id, cache_directory)
         run_manager.close()
         self.project.delete_node(run_node)
         # self.model.remove_node(run_node)
     except Exception, ex: # TODO catch more specific error?
         MessageBox.warning(self.view, 'Could not remove run', str(ex))
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:28,代码来源:xml_controller_results.py

示例9: on_syntaxButton_clicked

 def on_syntaxButton_clicked(self):
     node = self._checkImportNodeMsg()
     if node is None:
         return
     
     MessageBox.information(self, 'Check passed!',
                            self.ATTENTION)
开发者ID:apdjustino,项目名称:DRCOG_Urbansim,代码行数:7,代码来源:xml_editor.py

示例10: __init__

    def __init__(self, parent_widget):
        QDialog.__init__(self, parent_widget)
        self.setupUi(self)

        settings_directory = os.path.join(os.environ['OPUS_HOME'], 'settings')
        self._config_filename = os.path.join(settings_directory, 'database_server_configurations.xml')
        try:
            root = ElementTree(file=self._config_filename).getroot()
            view = XmlView(self)
            model = XmlModel(root)
            delegate = XmlItemDelegate(view)
            view.setModel(model)
            # Turns out that Qt Garbage collects the model (and delegate) if we don't explicitly
            # bind it to a Python object in addition to using the PyQt .setModel() method.
            view._model = model
            view._delegate = delegate
            view.setItemDelegate(delegate)
            view.openDefaultItems()

            self.gridlayout.addWidget(view)

            self.tree_view = view
            self.xml_root = root
            return

        except IOError, ex:
            MessageBox.error(mainwindow = self,
                          text = 'Could not initialize Database Settings',
                          detailed_text = str(ex))
            self.xml_root = None
            self._config_filename = ''
            self.configFile = None
开发者ID:christianurich,项目名称:VIBe2UrbanSim,代码行数:32,代码来源:databasesettings.py

示例11: _checkImportNodeMsg

 def _checkImportNodeMsg(self):
     try:
         return self._checkImportNode()
     except Exception, e:
         MessageBox.error(self, 'This is not a valid XML structure.', \
                          '''%s.\n\n%s''' % (e, self.ATTENTION))
         return None
开发者ID:apdjustino,项目名称:DRCOG_Urbansim,代码行数:7,代码来源:xml_editor.py

示例12: init_for_variable

    def init_for_variable(self, variable, validator, existing_variables):
        ''' Prepare the editor to edit a variable.
        @param variable The variable to edit (dict)
        @param validator A VariableValidator object used for data/syntax checking
        @param existing_variables a list of tuples with (dataset, variable name) for all existing
                                  variables. Used for checking for unique names.
        '''
        self.original_variable = variable # keep a reference to the original node...
        self.variable = variable.copy() # ...but manipulate a temporary variable
        self.validator = validator
        self.existing_variables = existing_variables or []

        self.leVarName.setText(variable['name'])
        self.le_var_def.document().setPlainText(variable['definition'])
        index = self.cboVarType.findText(variable['source'])
        if index < 0: # variable source was not in the combo box
            text = 'Failed to edit variable %s' % variable['name']
            details = ('Variable "%s" (dataset: %s) has an unknown type value (%s).\n'
                       'Please select a new type and update/save the variable.' %
                       (variable['name'], variable['dataset'], variable['source']))
            MessageBox.warning(self, text, details)
            
        # This triggers _update_variable_from_fields and hence requires
        # name and definition to be set already
        self.cboVarType.setCurrentIndex(index)

        if variable['use'] == 'model variable':
            self.rbUseModel.setChecked(True)
        elif variable['use'] == 'indicator':
            self.rbUseIndicator.setChecked(True)
        else:
            self.rbUseBoth.setChecked(True)
        self.leVarName.selectAll()
        self.leVarName.setFocus()
开发者ID:apdjustino,项目名称:DRCOG_Urbansim,代码行数:34,代码来源:variable_editor_savez.py

示例13: _scanForRuns

 def _scanForRuns(self):
     data_path = self.project.data_path()
     if not os.path.exists(data_path):
         MessageBox.warning(mainwindow = self.base_widget,
                            text="Project data path %s doesn't exist. " % data_path + \
                            "Simulation runs in the Results tab cannot be updated." )
         return
     
     run_manager = get_run_manager()
     run_manager.clean_runs()
     self._sync_base_year_data(run_manager)        
     run_manager.close()
     
     added_runs, removed_runs = sync_available_runs(self.project)
     added_msg = removed_msg = None
     if len(added_runs) > 0:
         added_msg = ('The following simulation runs have been '
                      'automatically added to the results manager:\n\n%s'
                      % '\n'.join(added_runs))
     if len(removed_runs) > 0:
         removed_msg = ('The following simulation runs have been '
                      'automatically removed from the results manager:\n\n%s'
                      % '\n'.join(removed_runs))
     if added_msg or removed_msg:
         ## The idea is to leave the run information to services db & cache, and
         ## we don't need to save the newly added runs, once we set the temporary
         # self.project.dirty = True
         text = 'The list of simulation runs has been automatically updated.'
         detailed_text = '%s\n%s' % (added_msg or '', removed_msg or '')
         logger.log_status(text+'\n'+detailed_text)
开发者ID:apdjustino,项目名称:DRCOG_Urbansim,代码行数:30,代码来源:results_manager.py

示例14: _get_viz_spec

    def _get_viz_spec(self):
        viz_type = self.cboVizType.currentText()
        translation = self._get_output_types(viz_type)
        dataset_name = self.dataset_name
        output_type = QString(translation[str(self.cboOutputType.currentText())])
        indicators = QString(str(self._get_column_values(column = 0)))

        vals = {
                'indicators': indicators,
                'output_type': output_type,
                'dataset_name': dataset_name,
                'visualization_type': QString(self._get_type_mapper()[str(viz_type)])
        }

        if output_type == 'mapnik_map' or output_type == 'mapnik_animated_map':
            vals['mapnik_bucket_labels'] = self.mapnik_options['mapnik_bucket_labels']
            vals['mapnik_bucket_colors'] = self.mapnik_options['mapnik_bucket_colors']
            vals['mapnik_bucket_ranges'] = self.mapnik_options['mapnik_bucket_ranges']
            vals['mapnik_resolution'] = self.mapnik_options['mapnik_resolution']
            vals['mapnik_page_dims'] = self.mapnik_options['mapnik_page_dims']
            vals['mapnik_map_lower_left'] = self.mapnik_options['mapnik_map_lower_left']
            vals['mapnik_map_upper_right'] = self.mapnik_options['mapnik_map_upper_right']
            vals['mapnik_legend_lower_left'] = self.mapnik_options['mapnik_legend_lower_left']
            vals['mapnik_legend_upper_right'] = self.mapnik_options['mapnik_legend_upper_right']


        elif output_type == 'fixed_field':
            try:
                fixed_field_params = QString(str(self._get_column_values(column = 1)))
            except:
                errorInfo = formatExceptionInfo()
                logger.log_error(errorInfo)
                MessageBox.error(mainwindow = self,
                                text = 'Could not get fixed field parameters for all columns',
                                detailed_text = '')
                return None

            vals['fixed_field_specification'] = fixed_field_params
            vals['id_format'] = self.leOption1.text()
        elif output_type == 'sql':
            vals['database_name'] = self.leOption1.text()
        elif output_type == 'esri':
            vals['storage_location'] = self.leOption1.text()
        elif output_type in ('tab', 'xls'):
            if self.rbSingleTable.isChecked():
                output_style = Table.ALL
            elif self.rbTablePerIndicator.isChecked():
                output_style = Table.PER_ATTRIBUTE
            elif self.rbTablePerYear.isChecked():
                output_style = Table.PER_YEAR
            vals['output_style'] = QString(str(output_style))
            if self.appendTypeCheckBox.isChecked():
                vals['append_col_type'] = True
            else:
                vals['append_col_type'] = False
            if output_type == 'xls':
                vals['storage_location'] = self.leOption1.text()

        return vals
开发者ID:apdjustino,项目名称:DRCOG_Urbansim,代码行数:59,代码来源:abstract_configure_batch_indicator_visualization.py

示例15: on_buttonBox_accepted

 def on_buttonBox_accepted(self):
     try:
         ElementTree(self.xml_root).write(self._config_filename, pretty_print=True, with_tail=False)
     except IOError, ex:
         MessageBox.error(self,
                       text = 'A disk error occured when saving the ' +
                       'settings.',
                       detailed_text = str(ex))
开发者ID:apdjustino,项目名称:DRCOG_Urbansim,代码行数:8,代码来源:databasesettings.py


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