def setup_page(self): settings_group = QGroupBox(_("Settings")) hist_spin = self.create_spinbox( _("History depth: "), _(" entries"), 'max_entries', min_=10, max_=10000, step=10, tip=_("Set maximum line count")) sourcecode_group = QGroupBox(_("Source code")) wrap_mode_box = self.create_checkbox(_("Wrap lines"), 'wrap') go_to_eof_box = self.create_checkbox( _("Scroll automatically to last entry"), 'go_to_eof') font_group = self.create_fontgroup(option=None, text=_("Font style"), fontfilters=QFontComboBox.MonospacedFonts) names = CONF.get('color_schemes', 'names') choices = list(zip(names, names)) cs_combo = self.create_combobox(_("Syntax color scheme: "), choices, 'color_scheme_name') settings_layout = QVBoxLayout() settings_layout.addWidget(hist_spin) settings_group.setLayout(settings_layout) sourcecode_layout = QVBoxLayout() sourcecode_layout.addWidget(wrap_mode_box) sourcecode_layout.addWidget(go_to_eof_box) sourcecode_layout.addWidget(cs_combo) sourcecode_group.setLayout(sourcecode_layout) vlayout = QVBoxLayout() vlayout.addWidget(font_group) vlayout.addWidget(settings_group) vlayout.addWidget(sourcecode_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): settings_group = QGroupBox(_("Settings")) use_color_box = self.create_checkbox( _("Use deterministic colors to differentiate functions"), 'use_colors', default=True) results_group = QGroupBox(_("Results")) results_label1 = QLabel(_("Memory profiler plugin results " "(the output of memory_profiler)\n" "is stored here:")) results_label1.setWordWrap(True) # Warning: do not try to regroup the following QLabel contents with # widgets above -- this string was isolated here in a single QLabel # on purpose: to fix Issue 863 of Profiler plugon results_label2 = QLabel(MemoryProfilerWidget.DATAPATH) results_label2.setTextInteractionFlags(Qt.TextSelectableByMouse) results_label2.setWordWrap(True) settings_layout = QVBoxLayout() settings_layout.addWidget(use_color_box) settings_group.setLayout(settings_layout) results_layout = QVBoxLayout() results_layout.addWidget(results_label1) results_layout.addWidget(results_label2) results_group.setLayout(results_layout) vlayout = QVBoxLayout() vlayout.addWidget(settings_group) vlayout.addWidget(results_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): """ Create the Spyder Config page for this plugin. As of Dec 2014, there are no options available to set, so we only display the data path. """ results_group = QGroupBox(_("Results")) results_label1 = QLabel(_("Results are stored here:")) results_label1.setWordWrap(True) # Warning: do not try to regroup the following QLabel contents with # widgets above -- this string was isolated here in a single QLabel # on purpose: to fix Issue 863 results_label2 = QLabel(CoverageWidget.DATAPATH) results_label2.setTextInteractionFlags(Qt.TextSelectableByMouse) results_label2.setWordWrap(True) results_layout = QVBoxLayout() results_layout.addWidget(results_label1) results_layout.addWidget(results_label2) results_group.setLayout(results_layout) vlayout = QVBoxLayout() vlayout.addWidget(results_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): settings_group = QGroupBox(_("Settings")) hist_spin = self.create_spinbox( _("History depth: "), _(" entries"), 'max_entries', min_=10, max_=10000, step=10, tip=_("Set maximum line count")) sourcecode_group = QGroupBox(_("Source code")) wrap_mode_box = self.create_checkbox(_("Wrap lines"), 'wrap') go_to_eof_box = self.create_checkbox( _("Scroll automatically to last entry"), 'go_to_eof') font_group = self.create_fontgroup(option=None, text=_("Font style"), fontfilters=QFontComboBox.MonospacedFonts) names = CONF.get('color_schemes', 'names') choices = list(zip(names, names)) cs_combo = self.create_combobox(_("Syntax color scheme: "), choices, 'color_scheme_name') settings_layout = QVBoxLayout() settings_layout.addWidget(hist_spin) settings_group.setLayout(settings_layout) sourcecode_layout = QVBoxLayout() sourcecode_layout.addWidget(wrap_mode_box) sourcecode_layout.addWidget(go_to_eof_box) sourcecode_layout.addWidget(cs_combo) sourcecode_group.setLayout(sourcecode_layout) vlayout = QVBoxLayout() vlayout.addWidget(settings_group) vlayout.addWidget(font_group) vlayout.addWidget(sourcecode_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): results_group = QGroupBox(_("Results")) results_label1 = QLabel( _("Profiler plugin results " "(the output of python's profile/cProfile)\n" "are stored here:")) results_label1.setWordWrap(True) # Warning: do not try to regroup the following QLabel contents with # widgets above -- this string was isolated here in a single QLabel # on purpose: to fix Issue 863 results_label2 = QLabel(ProfilerWidget.DATAPATH) results_label2.setTextInteractionFlags(Qt.TextSelectableByMouse) results_label2.setWordWrap(True) results_layout = QVBoxLayout() results_layout.addWidget(results_label1) results_layout.addWidget(results_label2) results_group.setLayout(results_layout) vlayout = QVBoxLayout() vlayout.addWidget(results_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): settings_group = QGroupBox(_("Settings")) hist_spin = self.create_spinbox(_("History depth: "), _(" entries"), 'max_entries', min_=10, max_=10000, step=10, tip=_("Set maximum line count")) sourcecode_group = QGroupBox(_("Source code")) wrap_mode_box = self.create_checkbox(_("Wrap lines"), 'wrap') go_to_eof_box = self.create_checkbox( _("Scroll automatically to last entry"), 'go_to_eof') settings_layout = QVBoxLayout() settings_layout.addWidget(hist_spin) settings_group.setLayout(settings_layout) sourcecode_layout = QVBoxLayout() sourcecode_layout.addWidget(wrap_mode_box) sourcecode_layout.addWidget(go_to_eof_box) sourcecode_group.setLayout(sourcecode_layout) vlayout = QVBoxLayout() vlayout.addWidget(settings_group) vlayout.addWidget(sourcecode_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): settings_group = QGroupBox(_("Settings")) use_color_box = self.create_checkbox( _("Use deterministic colors to differentiate functions"), 'use_colors', default=True) results_group = QGroupBox(_("Results")) results_label1 = QLabel(_("Line profiler plugin results " "(the output of kernprof.py)\n" "are stored here:")) results_label1.setWordWrap(True) # Warning: do not try to regroup the following QLabel contents with # widgets above -- this string was isolated here in a single QLabel # on purpose: to fix Issue 863 of Profiler plugon results_label2 = QLabel(LineProfilerWidget.DATAPATH) results_label2.setTextInteractionFlags(Qt.TextSelectableByMouse) results_label2.setWordWrap(True) settings_layout = QVBoxLayout() settings_layout.addWidget(use_color_box) settings_group.setLayout(settings_layout) results_layout = QVBoxLayout() results_layout.addWidget(results_label1) results_layout.addWidget(results_label2) results_group.setLayout(results_layout) vlayout = QVBoxLayout() vlayout.addWidget(settings_group) vlayout.addWidget(results_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): ar_group = QGroupBox(_("Autorefresh")) ar_box = self.create_checkbox(_("Enable autorefresh"), 'autorefresh') ar_spin = self.create_spinbox(_("Refresh interval: "), _(" ms"), 'autorefresh/timeout', min_=100, max_=1000000, step=100) filter_group = QGroupBox(_("Filter")) filter_data = [ ('exclude_private', _("Exclude private references")), ('exclude_capitalized', _("Exclude capitalized references")), ('exclude_uppercase', _("Exclude all-uppercase references")), ('exclude_unsupported', _("Exclude unsupported data types")), ] filter_boxes = [self.create_checkbox(text, option) for option, text in filter_data] display_group = QGroupBox(_("Display")) display_data = [ ('truncate', _("Truncate values"), ''), ('inplace', _("Always edit in-place"), ''), ('collvalue', _("Show collection contents"), ''), ] if programs.is_module_installed('numpy'): display_data.append(('minmax', _("Show arrays min/max"), '')) display_data.append( ('remote_editing', _("Edit data in the remote process"), _("Editors are opened in the remote process for NumPy " "arrays, PIL images, lists, tuples and dictionaries.\n" "This avoids transfering large amount of data between " "the remote process and Spyder (through the socket).")) ) display_boxes = [self.create_checkbox(text, option, tip=tip) for option, text, tip in display_data] ar_layout = QVBoxLayout() ar_layout.addWidget(ar_box) ar_layout.addWidget(ar_spin) ar_group.setLayout(ar_layout) filter_layout = QVBoxLayout() for box in filter_boxes: filter_layout.addWidget(box) filter_group.setLayout(filter_layout) display_layout = QVBoxLayout() for box in display_boxes: display_layout.addWidget(box) display_group.setLayout(display_layout) vlayout = QVBoxLayout() vlayout.addWidget(ar_group) vlayout.addWidget(filter_group) vlayout.addWidget(display_group) vlayout.addStretch(1) self.setLayout(vlayout)
def create_tab(self, *widgets): """Create simple tab widget page: widgets added in a vertical layout""" widget = QWidget() layout = QVBoxLayout() for widg in widgets: layout.addWidget(widg) layout.addStretch(1) widget.setLayout(layout) return widget
def setup_page(self): ar_group = QGroupBox(_("Autorefresh")) ar_box = self.create_checkbox(_("Enable autorefresh"), 'autorefresh') ar_spin = self.create_spinbox(_("Refresh interval: "), _(" ms"), 'autorefresh/timeout', min_=100, max_=1000000, step=100) filter_group = QGroupBox(_("Filter")) filter_data = [ ('exclude_private', _("Exclude private references")), ('exclude_capitalized', _("Exclude capitalized references")), ('exclude_uppercase', _("Exclude all-uppercase references")), ('exclude_unsupported', _("Exclude unsupported data types")), ] filter_boxes = [ self.create_checkbox(text, option) for option, text in filter_data ] display_group = QGroupBox(_("Display")) display_data = [('truncate', _("Truncate values"), '')] if programs.is_module_installed('numpy'): display_data.append(('minmax', _("Show arrays min/max"), '')) display_data.append( ('remote_editing', _("Edit data in the remote process"), _("Editors are opened in the remote process for NumPy " "arrays, PIL images, lists, tuples and dictionaries.\n" "This avoids transfering large amount of data between " "the remote process and Spyder (through the socket)."))) display_boxes = [ self.create_checkbox(text, option, tip=tip) for option, text, tip in display_data ] ar_layout = QVBoxLayout() ar_layout.addWidget(ar_box) ar_layout.addWidget(ar_spin) ar_group.setLayout(ar_layout) filter_layout = QVBoxLayout() for box in filter_boxes: filter_layout.addWidget(box) filter_group.setLayout(filter_layout) display_layout = QVBoxLayout() for box in display_boxes: display_layout.addWidget(box) display_group.setLayout(display_layout) vlayout = QVBoxLayout() vlayout.addWidget(ar_group) vlayout.addWidget(filter_group) vlayout.addWidget(display_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): settings_group = QGroupBox(_("Settings")) save_box = self.create_checkbox(_("Save file before analyzing it"), 'save_before', default=True) hist_group = QGroupBox(_("History")) hist_label1 = QLabel( _("The following option will be applied at next " "startup.")) hist_label1.setWordWrap(True) hist_spin = self.create_spinbox(_("History: "), _(" results"), 'max_entries', default=50, min_=10, max_=1000000, step=10) results_group = QGroupBox(_("Results")) results_label1 = QLabel(_("Results are stored here:")) results_label1.setWordWrap(True) # Warning: do not try to regroup the following QLabel contents with # widgets above -- this string was isolated here in a single QLabel # on purpose: to fix Issue 863 results_label2 = QLabel(PylintWidget.DATAPATH) results_label2.setTextInteractionFlags(Qt.TextSelectableByMouse) results_label2.setWordWrap(True) settings_layout = QVBoxLayout() settings_layout.addWidget(save_box) settings_group.setLayout(settings_layout) hist_layout = QVBoxLayout() hist_layout.addWidget(hist_label1) hist_layout.addWidget(hist_spin) hist_group.setLayout(hist_layout) results_layout = QVBoxLayout() results_layout.addWidget(results_label1) results_layout.addWidget(results_label2) results_group.setLayout(results_layout) vlayout = QVBoxLayout() vlayout.addWidget(settings_group) vlayout.addWidget(hist_group) vlayout.addWidget(results_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): results_group = QGroupBox(_("Group page")) lineedit = self.create_lineedit(_('Example line'), 'example_line', default='default_value', alignment=Qt.Horizontal, ) results_layout = QVBoxLayout() results_layout.addWidget(lineedit) results_group.setLayout(results_layout) vlayout = QVBoxLayout() vlayout.addWidget(results_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): settings_group = QGroupBox(_("Settings")) save_box = self.create_checkbox(_("Save file before analyzing it"), 'save_before', default=True) hist_group = QGroupBox(_("History")) hist_label1 = QLabel(_("The following option will be applied at next " "startup.")) hist_label1.setWordWrap(True) hist_spin = self.create_spinbox(_("History: "), _(" results"), 'max_entries', default=50, min_=10, max_=1000000, step=10) results_group = QGroupBox(_("Results")) results_label1 = QLabel(_("Results are stored here:")) results_label1.setWordWrap(True) # Warning: do not try to regroup the following QLabel contents with # widgets above -- this string was isolated here in a single QLabel # on purpose: to fix Issue 863 results_label2 = QLabel(PylintWidget.DATAPATH) results_label2.setTextInteractionFlags(Qt.TextSelectableByMouse) results_label2.setWordWrap(True) settings_layout = QVBoxLayout() settings_layout.addWidget(save_box) settings_group.setLayout(settings_layout) hist_layout = QVBoxLayout() hist_layout.addWidget(hist_label1) hist_layout.addWidget(hist_spin) hist_group.setLayout(hist_layout) results_layout = QVBoxLayout() results_layout.addWidget(results_label1) results_layout.addWidget(results_label2) results_group.setLayout(results_layout) vlayout = QVBoxLayout() vlayout.addWidget(settings_group) vlayout.addWidget(hist_group) vlayout.addWidget(results_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): results_group = QGroupBox(_("Group page")) lineedit = self.create_lineedit( _('Example line'), 'example_line', default='default_value', alignment=Qt.Horizontal, ) results_layout = QVBoxLayout() results_layout.addWidget(lineedit) results_group.setLayout(results_layout) vlayout = QVBoxLayout() vlayout.addWidget(results_group) vlayout.addStretch(1) self.setLayout(vlayout)
def __init__(self): super(TestWindow, self).__init__() self.setGeometry(300, 100, 400, 600) self.setWindowTitle('Exploring QMainWindow') self.exit = QAction('Exit', self) self.exit.setStatusTip('Exit program') # create the menu bar menubar = self.menuBar() file_ = menubar.addMenu('&File') file_.addAction(self.exit) # create the status bar self.statusBar() # QWidget or its instance needed for box layout self.widget = QWidget(self) self.button = QPushButton('test') self.button1 = QPushButton('1') self.button2 = QPushButton('2') effect = QGraphicsOpacityEffect(self.button2) self.button2.setGraphicsEffect(effect) self.anim = QPropertyAnimation(effect, "opacity") self.anim.setStartValue(0.01) self.anim.setEndValue(1.0) self.anim.setDuration(500) lay = QVBoxLayout() lay.addWidget(self.button) lay.addStretch() lay.addWidget(self.button1) lay.addWidget(self.button2) self.widget.setLayout(lay) self.setCentralWidget(self.widget) self.button.clicked.connect(self.action1) self.button1.clicked.connect(self.action2) self.tour = AnimatedTour(self)
def setup_page(self): """ Setup of the configuration page. All widgets need to be added here""" setup_group = QGroupBox(_("RateLaw Plugin Configuration")) setup_label = QLabel(_("RateLaw plugin configuration needs to be "\ "implemented here.\n")) setup_label.setWordWrap(True) # Warning: do not try to regroup the following QLabel contents with # widgets above -- this string was isolated here in a single QLabel # on purpose: to fix Issue 863 setup_layout = QVBoxLayout() setup_layout.addWidget(setup_label) setup_group.setLayout(setup_layout) vlayout = QVBoxLayout() vlayout.addWidget(setup_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): network_group = QGroupBox(_("Network settings")) self.checkbox_proxy = self.create_checkbox(_("Use network proxy"), 'use_proxy_flag', default=False) server = self.create_lineedit(_('Server'), 'server', default='', alignment=Qt.Horizontal) port = self.create_lineedit(_('Port'), 'port', default='', alignment=Qt.Horizontal) user = self.create_lineedit(_('User'), 'user', default='', alignment=Qt.Horizontal) password = self.create_lineedit(_('Password'), 'password', default='', alignment=Qt.Horizontal) self.widgets = [server, port, user, password] network_layout = QGridLayout() network_layout.addWidget(self.checkbox_proxy, 0, 0) network_layout.addWidget(server, 1, 0) network_layout.addWidget(port, 1, 1) network_layout.addWidget(user, 2, 0) network_layout.addWidget(password, 2, 1) network_group.setLayout(network_layout) vlayout = QVBoxLayout() vlayout.addWidget(network_group) vlayout.addStretch(1) self.setLayout(vlayout) # signals self.checkbox_proxy.clicked.connect(self.proxy_settings) self.proxy_settings()
def setup_page(self): interface_group = QGroupBox(_("Interface")) styles = [str(txt) for txt in QStyleFactory.keys()] choices = zip(styles, [style.lower() for style in styles]) style_combo = self.create_combobox(_('Qt windows style'), choices, 'windows_style', default=self.main.default_style) newcb = self.create_checkbox vertdock_box = newcb(_("Vertical dockwidget title bars"), 'vertical_dockwidget_titlebars') verttabs_box = newcb(_("Vertical dockwidget tabs"), 'vertical_tabs') animated_box = newcb(_("Animated toolbars and dockwidgets"), 'animated_docks') margin_box = newcb(_("Custom dockwidget margin:"), 'use_custom_margin') margin_spin = self.create_spinbox("", "pixels", 'custom_margin', 0, 0, 30) self.connect(margin_box, SIGNAL("toggled(bool)"), margin_spin.setEnabled) margin_spin.setEnabled(self.get_option('use_custom_margin')) margins_layout = QHBoxLayout() margins_layout.addWidget(margin_box) margins_layout.addWidget(margin_spin) interface_layout = QVBoxLayout() interface_layout.addWidget(style_combo) interface_layout.addWidget(vertdock_box) interface_layout.addWidget(verttabs_box) interface_layout.addWidget(animated_box) interface_layout.addLayout(margins_layout) interface_group.setLayout(interface_layout) vlayout = QVBoxLayout() vlayout.addWidget(interface_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): sourcecode_group = QGroupBox(_("Source code")) wrap_mode_box = self.create_checkbox(_("Wrap lines"), 'wrap') plain_text_font_group = self.create_fontgroup(option=None, text=_("Plain text font style"), fontfilters=QFontComboBox.MonospacedFonts) rich_text_font_group = self.create_fontgroup(option='rich_text', text=_("Rich text font style")) names = CONF.get('color_schemes', 'names') choices = zip(names, names) cs_combo = self.create_combobox(_("Syntax color scheme: "), choices, 'color_scheme_name') sourcecode_layout = QVBoxLayout() sourcecode_layout.addWidget(wrap_mode_box) sourcecode_layout.addWidget(cs_combo) sourcecode_group.setLayout(sourcecode_layout) vlayout = QVBoxLayout() vlayout.addWidget(rich_text_font_group) vlayout.addWidget(plain_text_font_group) vlayout.addWidget(sourcecode_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): results_group = QGroupBox(_("Results")) results_label1 = QLabel(_("Profiler plugin results "\ "(the output of python's profile/cProfile)\n" "are stored here:")) results_label1.setWordWrap(True) # Warning: do not try to regroup the following QLabel contents with # widgets above -- this string was isolated here in a single QLabel # on purpose: to fix Issue 863 results_label2 = QLabel(ProfilerWidget.DATAPATH) results_label2.setTextInteractionFlags(Qt.TextSelectableByMouse) results_label2.setWordWrap(True) results_layout = QVBoxLayout() results_layout.addWidget(results_label1) results_layout.addWidget(results_label2) results_group.setLayout(results_layout) vlayout = QVBoxLayout() vlayout.addWidget(results_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): run_dlg = _("Run Settings") run_menu = _("Run") about_label = QLabel(_("The following are the default <i>%s</i>. "\ "These options may be overriden using the "\ "<b>%s</b> dialog box (see the <b>%s</b> menu)"\ ) % (run_dlg, run_dlg, run_menu)) about_label.setWordWrap(True) interpreter_group = QGroupBox(_("Console")) interpreter_bg = QButtonGroup(interpreter_group) self.current_radio = self.create_radiobutton(CURRENT_INTERPRETER, CURRENT_INTERPRETER_OPTION, True, button_group=interpreter_bg) self.dedicated_radio = self.create_radiobutton(DEDICATED_INTERPRETER, DEDICATED_INTERPRETER_OPTION, False, button_group=interpreter_bg) self.systerm_radio = self.create_radiobutton(SYSTERM_INTERPRETER, SYSTERM_INTERPRETER_OPTION, False, button_group=interpreter_bg) interpreter_layout = QVBoxLayout() interpreter_group.setLayout(interpreter_layout) interpreter_layout.addWidget(self.current_radio) interpreter_layout.addWidget(self.dedicated_radio) interpreter_layout.addWidget(self.systerm_radio) wdir_group = QGroupBox(_("Working directory")) wdir_bg = QButtonGroup(wdir_group) wdir_label = QLabel(_("Default working directory is:")) wdir_label.setWordWrap(True) dirname_radio = self.create_radiobutton(_("the script directory"), WDIR_USE_SCRIPT_DIR_OPTION, True, button_group=wdir_bg) thisdir_radio = self.create_radiobutton(_("the following directory:"), WDIR_USE_FIXED_DIR_OPTION, False, button_group=wdir_bg) thisdir_bd = self.create_browsedir("", WDIR_FIXED_DIR_OPTION, getcwd()) self.connect(thisdir_radio, SIGNAL("toggled(bool)"), thisdir_bd.setEnabled) self.connect(dirname_radio, SIGNAL("toggled(bool)"), thisdir_bd.setDisabled) thisdir_layout = QHBoxLayout() thisdir_layout.addWidget(thisdir_radio) thisdir_layout.addWidget(thisdir_bd) wdir_layout = QVBoxLayout() wdir_layout.addWidget(wdir_label) wdir_layout.addWidget(dirname_radio) wdir_layout.addLayout(thisdir_layout) wdir_group.setLayout(wdir_layout) firstrun_cb = self.create_checkbox( ALWAYS_OPEN_FIRST_RUN % _("Run Settings dialog"), ALWAYS_OPEN_FIRST_RUN_OPTION, False) vlayout = QVBoxLayout() vlayout.addWidget(about_label) vlayout.addSpacing(10) vlayout.addWidget(interpreter_group) vlayout.addWidget(wdir_group) vlayout.addWidget(firstrun_cb) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): # Fonts group plain_text_font_group = self.create_fontgroup( option=None, text=_("Plain text font style"), fontfilters=QFontComboBox.MonospacedFonts ) rich_text_font_group = self.create_fontgroup(option="rich_text", text=_("Rich text font style")) # Connections group connections_group = QGroupBox(_("Automatic connections")) connections_label = QLabel( _( "The Object Inspector can automatically " "show an object's help information after " "a left parenthesis is written next to it. " "Below you can decide to which plugin " "you want to connect it to turn on this " "feature." ) ) connections_label.setWordWrap(True) editor_box = self.create_checkbox(_("Editor"), "connect/editor") rope_installed = programs.is_module_installed("rope") jedi_installed = programs.is_module_installed("jedi", ">=0.8.0") editor_box.setEnabled(rope_installed or jedi_installed) # TODO: Don't forget to add Jedi here if not rope_installed: rope_tip = _("This feature requires the Rope library.\n" "It seems you don't have it installed.") editor_box.setToolTip(rope_tip) python_box = self.create_checkbox(_("Python Console"), "connect/python_console") ipython_box = self.create_checkbox(_("IPython Console"), "connect/ipython_console") ipython_installed = programs.is_module_installed("IPython", ">=0.13") ipython_box.setEnabled(ipython_installed) connections_layout = QVBoxLayout() connections_layout.addWidget(connections_label) connections_layout.addWidget(editor_box) connections_layout.addWidget(python_box) connections_layout.addWidget(ipython_box) connections_group.setLayout(connections_layout) # Features group features_group = QGroupBox(_("Additional features")) math_box = self.create_checkbox(_("Render mathematical equations"), "math") req_sphinx = sphinx_version is not None and programs.is_module_installed("sphinx", ">=1.1") math_box.setEnabled(req_sphinx) if not req_sphinx: sphinx_tip = _("This feature requires Sphinx 1.1 or superior.") if sphinx_version is not None: sphinx_tip += "\n" + _("Sphinx %s is currently installed.") % sphinx_version math_box.setToolTip(sphinx_tip) features_layout = QVBoxLayout() features_layout.addWidget(math_box) features_group.setLayout(features_layout) # Source code group sourcecode_group = QGroupBox(_("Source code")) wrap_mode_box = self.create_checkbox(_("Wrap lines"), "wrap") names = CONF.get("color_schemes", "names") choices = list(zip(names, names)) cs_combo = self.create_combobox(_("Syntax color scheme: "), choices, "color_scheme_name") sourcecode_layout = QVBoxLayout() sourcecode_layout.addWidget(wrap_mode_box) sourcecode_layout.addWidget(cs_combo) sourcecode_group.setLayout(sourcecode_layout) # Final layout vlayout = QVBoxLayout() vlayout.addWidget(rich_text_font_group) vlayout.addWidget(plain_text_font_group) vlayout.addWidget(connections_group) vlayout.addWidget(features_group) vlayout.addWidget(sourcecode_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): newcb = self.create_checkbox # --- Interface interface_group = QGroupBox(_("Interface")) styles = [str(txt) for txt in list(QStyleFactory.keys())] # Don't offer users the possibility to change to a different # style in Gtk-based desktops # Fixes Issue 2036 if is_gtk_desktop() and ('GTK+' in styles): styles = ['GTK+'] choices = list(zip(styles, [style.lower() for style in styles])) style_combo = self.create_combobox(_('Qt windows style'), choices, 'windows_style', default=self.main.default_style) themes = ['Spyder 2', 'Spyder 3'] icon_choices = list(zip(themes, [theme.lower() for theme in themes])) icons_combo = self.create_combobox(_('Icon theme'), icon_choices, 'icon_theme', restart=True) languages = LANGUAGE_CODES.items() language_choices = sorted([(val, key) for key, val in languages]) language_combo = self.create_combobox(_('Language'), language_choices, 'interface_language', restart=True) single_instance_box = newcb(_("Use a single instance"), 'single_instance', tip=_("Set this to open external<br> " "Python files in an already running " "instance (Requires a restart)")) vertdock_box = newcb(_("Vertical title bars in panes"), 'vertical_dockwidget_titlebars') verttabs_box = newcb(_("Vertical tabs in panes"), 'vertical_tabs') animated_box = newcb(_("Animated toolbars and panes"), 'animated_docks') tear_off_box = newcb(_("Tear off menus"), 'tear_off_menus', tip=_("Set this to detach any<br> " "menu from the main window")) margin_box = newcb(_("Custom margin for panes:"), 'use_custom_margin') margin_spin = self.create_spinbox("", "pixels", 'custom_margin', 0, 0, 30) margin_box.toggled.connect(margin_spin.setEnabled) margin_spin.setEnabled(self.get_option('use_custom_margin')) margins_layout = QHBoxLayout() margins_layout.addWidget(margin_box) margins_layout.addWidget(margin_spin) prompt_box = newcb(_("Prompt when exiting"), 'prompt_on_exit') # Decide if it's possible to activate or not single instance mode if running_in_mac_app(): self.set_option("single_instance", True) single_instance_box.setEnabled(False) # Layout interface comboboxes_layout = QHBoxLayout() cbs_layout = QGridLayout() cbs_layout.addWidget(style_combo.label, 0, 0) cbs_layout.addWidget(style_combo.combobox, 0, 1) cbs_layout.addWidget(icons_combo.label, 1, 0) cbs_layout.addWidget(icons_combo.combobox, 1, 1) cbs_layout.addWidget(language_combo.label, 2, 0) cbs_layout.addWidget(language_combo.combobox, 2, 1) comboboxes_layout.addLayout(cbs_layout) comboboxes_layout.addStretch(1) interface_layout = QVBoxLayout() interface_layout.addLayout(comboboxes_layout) interface_layout.addWidget(single_instance_box) interface_layout.addWidget(vertdock_box) interface_layout.addWidget(verttabs_box) interface_layout.addWidget(animated_box) interface_layout.addWidget(tear_off_box) interface_layout.addLayout(margins_layout) interface_layout.addWidget(prompt_box) interface_group.setLayout(interface_layout) # --- Status bar sbar_group = QGroupBox(_("Status bar")) show_status_bar = newcb(_("Show status bar"), 'show_status_bar') memory_box = newcb(_("Show memory usage every"), 'memory_usage/enable', tip=self.main.mem_status.toolTip()) memory_spin = self.create_spinbox("", " ms", 'memory_usage/timeout', min_=100, max_=1000000, step=100) memory_box.toggled.connect(memory_spin.setEnabled) memory_spin.setEnabled(self.get_option('memory_usage/enable')) memory_box.setEnabled(self.main.mem_status.is_supported()) memory_spin.setEnabled(self.main.mem_status.is_supported()) cpu_box = newcb(_("Show CPU usage every"), 'cpu_usage/enable', tip=self.main.cpu_status.toolTip()) cpu_spin = self.create_spinbox("", " ms", 'cpu_usage/timeout', min_=100, max_=1000000, step=100) cpu_box.toggled.connect(cpu_spin.setEnabled) cpu_spin.setEnabled(self.get_option('cpu_usage/enable')) cpu_box.setEnabled(self.main.cpu_status.is_supported()) cpu_spin.setEnabled(self.main.cpu_status.is_supported()) status_bar_o = self.get_option('show_status_bar') show_status_bar.toggled.connect(memory_box.setEnabled) show_status_bar.toggled.connect(memory_spin.setEnabled) show_status_bar.toggled.connect(cpu_box.setEnabled) show_status_bar.toggled.connect(cpu_spin.setEnabled) memory_box.setEnabled(status_bar_o) memory_spin.setEnabled(status_bar_o) cpu_box.setEnabled(status_bar_o) cpu_spin.setEnabled(status_bar_o) # Layout status bar cpu_memory_layout = QGridLayout() cpu_memory_layout.addWidget(memory_box, 0, 0) cpu_memory_layout.addWidget(memory_spin, 0, 1) cpu_memory_layout.addWidget(cpu_box, 1, 0) cpu_memory_layout.addWidget(cpu_spin, 1, 1) sbar_layout = QVBoxLayout() sbar_layout.addWidget(show_status_bar) sbar_layout.addLayout(cpu_memory_layout) sbar_group.setLayout(sbar_layout) # --- Debugging debug_group = QGroupBox(_("Debugging")) popup_console_box = newcb(_("Pop up internal console when internal " "errors appear"), 'show_internal_console_if_traceback') debug_layout = QVBoxLayout() debug_layout.addWidget(popup_console_box) debug_group.setLayout(debug_layout) # --- Spyder updates update_group = QGroupBox(_("Updates")) check_updates = newcb(_("Check for updates on startup"), 'check_updates_on_startup') update_layout = QVBoxLayout() update_layout.addWidget(check_updates) update_group.setLayout(update_layout) vlayout = QVBoxLayout() vlayout.addWidget(interface_group) vlayout.addWidget(sbar_group) vlayout.addWidget(debug_group) vlayout.addWidget(update_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): # Connections group connections_group = QGroupBox(_("Automatic connections")) connections_label = QLabel(_("This pane can automatically " "show an object's help information after " "a left parenthesis is written next to it. " "Below you can decide to which plugin " "you want to connect it to turn on this " "feature.")) connections_label.setWordWrap(True) editor_box = self.create_checkbox(_("Editor"), 'connect/editor') rope_installed = programs.is_module_installed('rope') jedi_installed = programs.is_module_installed('jedi', '>=0.8.1') editor_box.setEnabled(rope_installed or jedi_installed) if not rope_installed and not jedi_installed: editor_tip = _("This feature requires the Rope or Jedi libraries.\n" "It seems you don't have either installed.") editor_box.setToolTip(editor_tip) python_box = self.create_checkbox(_("Python Console"), 'connect/python_console') ipython_box = self.create_checkbox(_("IPython Console"), 'connect/ipython_console') ipython_box.setEnabled(QTCONSOLE_INSTALLED) connections_layout = QVBoxLayout() connections_layout.addWidget(connections_label) connections_layout.addWidget(editor_box) connections_layout.addWidget(python_box) connections_layout.addWidget(ipython_box) connections_group.setLayout(connections_layout) # Features group features_group = QGroupBox(_("Additional features")) math_box = self.create_checkbox(_("Render mathematical equations"), 'math') req_sphinx = programs.is_module_installed('sphinx', '>=1.1') math_box.setEnabled(req_sphinx) if not req_sphinx: sphinx_ver = programs.get_module_version('sphinx') sphinx_tip = _("This feature requires Sphinx 1.1 or superior.") sphinx_tip += "\n" + _("Sphinx %s is currently installed.") % sphinx_ver math_box.setToolTip(sphinx_tip) features_layout = QVBoxLayout() features_layout.addWidget(math_box) features_group.setLayout(features_layout) # Source code group sourcecode_group = QGroupBox(_("Source code")) wrap_mode_box = self.create_checkbox(_("Wrap lines"), 'wrap') sourcecode_layout = QVBoxLayout() sourcecode_layout.addWidget(wrap_mode_box) sourcecode_group.setLayout(sourcecode_layout) # Final layout vlayout = QVBoxLayout() vlayout.addWidget(connections_group) vlayout.addWidget(features_group) vlayout.addWidget(sourcecode_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): run_dlg = _("Run Settings") run_menu = _("Run") about_label = QLabel(_("The following are the default <i>%s</i>. "\ "These options may be overriden using the "\ "<b>%s</b> dialog box (see the <b>%s</b> menu)"\ ) % (run_dlg, run_dlg, run_menu)) about_label.setWordWrap(True) interpreter_group = QGroupBox(_("Console")) interpreter_bg = QButtonGroup(interpreter_group) self.current_radio = self.create_radiobutton(CURRENT_INTERPRETER, CURRENT_INTERPRETER_OPTION, True, button_group=interpreter_bg) self.dedicated_radio = self.create_radiobutton(DEDICATED_INTERPRETER, DEDICATED_INTERPRETER_OPTION, False, button_group=interpreter_bg) self.systerm_radio = self.create_radiobutton(SYSTERM_INTERPRETER, SYSTERM_INTERPRETER_OPTION, False, button_group=interpreter_bg) interpreter_layout = QVBoxLayout() interpreter_group.setLayout(interpreter_layout) interpreter_layout.addWidget(self.current_radio) interpreter_layout.addWidget(self.dedicated_radio) interpreter_layout.addWidget(self.systerm_radio) general_group = QGroupBox("General settings") wdir_bg = QButtonGroup(general_group) wdir_label = QLabel(_("Default working directory is:")) wdir_label.setWordWrap(True) dirname_radio = self.create_radiobutton(_("the script directory"), WDIR_USE_SCRIPT_DIR_OPTION, True, button_group=wdir_bg) thisdir_radio = self.create_radiobutton(_("the following directory:"), WDIR_USE_FIXED_DIR_OPTION, False, button_group=wdir_bg) thisdir_bd = self.create_browsedir("", WDIR_FIXED_DIR_OPTION, getcwd()) thisdir_radio.toggled.connect(thisdir_bd.setEnabled) dirname_radio.toggled.connect(thisdir_bd.setDisabled) thisdir_layout = QHBoxLayout() thisdir_layout.addWidget(thisdir_radio) thisdir_layout.addWidget(thisdir_bd) post_mortem = self.create_checkbox( _("Enter debugging mode when errors appear during execution"), 'post_mortem', False) general_layout = QVBoxLayout() general_layout.addWidget(wdir_label) general_layout.addWidget(dirname_radio) general_layout.addLayout(thisdir_layout) general_layout.addWidget(post_mortem) general_group.setLayout(general_layout) dedicated_group = QGroupBox(_("Dedicated Python console")) interact_after = self.create_checkbox( _("Interact with the Python console after execution"), 'interact', False) show_warning = self.create_checkbox( _("Show warning when killing running processes"), 'show_kill_warning', True) dedicated_layout = QVBoxLayout() dedicated_layout.addWidget(interact_after) dedicated_layout.addWidget(show_warning) dedicated_group.setLayout(dedicated_layout) firstrun_cb = self.create_checkbox( ALWAYS_OPEN_FIRST_RUN % _("Run Settings dialog"), ALWAYS_OPEN_FIRST_RUN_OPTION, False) vlayout = QVBoxLayout() vlayout.addWidget(about_label) vlayout.addSpacing(10) vlayout.addWidget(interpreter_group) vlayout.addWidget(general_group) vlayout.addWidget(dedicated_group) vlayout.addWidget(firstrun_cb) vlayout.addStretch(1) self.setLayout(vlayout)
def __init__(self, parent, max_entries=100): """ Creates a very basic window with some text """ """ RATE_LAW_MESSAGE = \ "The Plugins for Spyder consists out of three main classes: \n\n" \ "1. HelloWorld\n\n" \ "\tThe HelloWorld class inherits all its methods from\n" \ "\tSpyderPluginMixin and the HelloWorldWidget and performs all\n" \ "\tthe processing required by the GU. \n\n" \ "2. HelloWorldConfigPage\n\n" \ "\tThe HelloWorldConfig class inherits all its methods from\n" \ "\tPluginConfigPage to create a configuration page that can be\n" \ "\tfound under Tools -> Preferences\n\n" \ "3. HelloWorldWidget\n\n" \ "\tThe HelloWorldWidget class inherits all its methods from\n" \ "\tQWidget to create the actual plugin GUI interface that \n" \ "\tdisplays this message on screen\n\n" """ #Testing access editor on plugin initialization RATE_LAW_MESSAGE = "" displaynamelist = [] #displaylist = [] infixlist = [] desclist = [] parameterstringlist = [] xmldoc = minidom.parse('\\.spyder2\\ratelaw2_0_3.xml') #xmldoc = minidom.parse('%\\Downloads\\ratelaw2_0_3.xml') lawlistxml = xmldoc.getElementsByTagName('law') #i is the number of laws currently in the xml file i = 0 for s in lawlistxml: #RATE_LAW_MESSAGE += s.getAttribute('displayName') + "\n" RATE_LAW_MESSAGE += s.getAttribute('display') + "\n" #displaynamelist[i] = s.getAttribute('displayName') #displaylist[i] = s.getAttribute('display') displaynamelist.append(s.getAttribute('displayName')) #displaylist.append(s.getAttribute('display')) infixlist.append(s.getAttribute('infixExpression')) desclist.append(s.getAttribute('description')) parameterlist = s.getElementsByTagName('listOfParameters')[0] #for p in parameterlist parameters = parameterlist.getElementsByTagName('parameter') parameterstring = "" for param in parameters: parametername = param.attributes['name'].value parameterdesc = param.attributes['description'].value parameterstring = parameterstring + '\t' + parametername + ":" + '\t' + " " + parameterdesc + "\n" #print('\t' + parametername + ":" + '\t' + parameterdesc) parameterstringlist.append(parameterstring) i = i + 1 QWidget.__init__(self, parent) self.setWindowTitle("Rate Law Library") self.output = None self.error_output = None self._last_wdir = None self._last_args = None self._last_pythonpath = None self.textlabel = QLabel(RATE_LAW_MESSAGE) self.lawlist = QListWidget() self.lawpage = QStackedWidget() #Adding displayName items to lawlist for j in range(i): item = QListWidgetItem(displaynamelist[j]) self.lawlist.addItem(item) self.lawdetailpage = QWidget() # Page layout will become its own function setup_group = QGroupBox(displaynamelist[j]) infixmod = infixlist[j].replace("___"," ") setup_label = QLabel(infixmod) setup_label.setWordWrap(True) desc_group = QGroupBox("Description") desc_label = QLabel(desclist[j]) desc_label.setWordWrap(True) param_label = QLabel(parameterstringlist[j]) param_label.setWordWrap(True) # Warning: do not try to regroup the following QLabel contents with # widgets above -- this string was isolated here in a single QLabel # on purpose: to fix Issue 863 setup_layout = QVBoxLayout() setup_layout.addWidget(setup_label) setup_group.setLayout(setup_layout) desc_layout = QVBoxLayout() desc_layout.addWidget(desc_label) desc_layout.addWidget(param_label) desc_group.setLayout(desc_layout) vlayout = QVBoxLayout() vlayout.addWidget(setup_group) vlayout.addWidget(desc_group) vlayout.addStretch(1) self.lawdetailpage.setLayout(vlayout) self.lawpage.addWidget(self.lawdetailpage) #self.connect(self.lawlist, SIGNAL(self.lawlist.currentRowChanged(int)),self.lawpage,SLOT(self.lawpage.setCurrentIndex(int))) self.lawlist.currentRowChanged.connect(self.lawpage.setCurrentIndex) ''' self.lawpage = QWidget() ''' self.lawlist.setCurrentRow(0) hsplitter = QSplitter() hsplitter.addWidget(self.lawlist) hlayout1 = QHBoxLayout() hlayout1.addWidget(self.textlabel) hlayout1.addStretch() self.lawpage.setLayout(hlayout1) hsplitter.addWidget(self.lawpage) layout = QVBoxLayout() layout.addWidget(hsplitter) self.setLayout(layout)
def setup_page(self): # Fonts group plain_text_font_group = self.create_fontgroup( option=None, text=_("Plain text font style"), fontfilters=QFontComboBox.MonospacedFonts) rich_text_font_group = self.create_fontgroup( option='rich_text', text=_("Rich text font style")) # Connections group connections_group = QGroupBox(_("Automatic connections")) connections_label = QLabel( _("The Object Inspector can automatically " "show an object's help information after " "a left parenthesis is written next to it. " "Below you can decide to which plugin " "you want to connect it to turn on this " "feature.")) connections_label.setWordWrap(True) editor_box = self.create_checkbox(_("Editor"), 'connect/editor') rope_installed = programs.is_module_installed('rope') jedi_installed = programs.is_module_installed('jedi', '>=0.8.0') editor_box.setEnabled(rope_installed or jedi_installed) # TODO: Don't forget to add Jedi here if not rope_installed: rope_tip = _("This feature requires the Rope library.\n" "It seems you don't have it installed.") editor_box.setToolTip(rope_tip) python_box = self.create_checkbox(_("Python Console"), 'connect/python_console') ipython_box = self.create_checkbox(_("IPython Console"), 'connect/ipython_console') ipython_installed = programs.is_module_installed('IPython', '>=0.13') ipython_box.setEnabled(ipython_installed) connections_layout = QVBoxLayout() connections_layout.addWidget(connections_label) connections_layout.addWidget(editor_box) connections_layout.addWidget(python_box) connections_layout.addWidget(ipython_box) connections_group.setLayout(connections_layout) # Features group features_group = QGroupBox(_("Additional features")) math_box = self.create_checkbox(_("Render mathematical equations"), 'math') req_sphinx = sphinx_version is not None and \ programs.is_module_installed('sphinx', '>=1.1') math_box.setEnabled(req_sphinx) if not req_sphinx: sphinx_tip = _("This feature requires Sphinx 1.1 or superior.") if sphinx_version is not None: sphinx_tip += "\n" + _( "Sphinx %s is currently installed.") % sphinx_version math_box.setToolTip(sphinx_tip) features_layout = QVBoxLayout() features_layout.addWidget(math_box) features_group.setLayout(features_layout) # Source code group sourcecode_group = QGroupBox(_("Source code")) wrap_mode_box = self.create_checkbox(_("Wrap lines"), 'wrap') names = CONF.get('color_schemes', 'names') choices = list(zip(names, names)) cs_combo = self.create_combobox(_("Syntax color scheme: "), choices, 'color_scheme_name') sourcecode_layout = QVBoxLayout() sourcecode_layout.addWidget(wrap_mode_box) sourcecode_layout.addWidget(cs_combo) sourcecode_group.setLayout(sourcecode_layout) # Final layout vlayout = QVBoxLayout() vlayout.addWidget(rich_text_font_group) vlayout.addWidget(plain_text_font_group) vlayout.addWidget(connections_group) vlayout.addWidget(features_group) vlayout.addWidget(sourcecode_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): newcb = self.create_checkbox # --- Interface interface_group = QGroupBox(_("Interface")) styles = [str(txt) for txt in list(QStyleFactory.keys())] # Don't offer users the possibility to change to a different # style in Gtk-based desktops # Fixes Issue 2036 if is_gtk_desktop() and ('GTK+' in styles): styles = ['GTK+'] choices = list(zip(styles, [style.lower() for style in styles])) style_combo = self.create_combobox(_('Qt windows style'), choices, 'windows_style', default=self.main.default_style) themes = ['Spyder 2', 'Spyder 3'] icon_choices = list(zip(themes, [theme.lower() for theme in themes])) icons_combo = self.create_combobox(_('Icon theme'), icon_choices, 'icon_theme', restart=True) languages = LANGUAGE_CODES.items() language_choices = sorted([(val, key) for key, val in languages]) language_combo = self.create_combobox(_('Language'), language_choices, 'interface_language', restart=True) single_instance_box = newcb(_("Use a single instance"), 'single_instance', tip=_("Set this to open external<br> " "Python files in an already running " "instance (Requires a restart)")) vertdock_box = newcb(_("Vertical title bars in panes"), 'vertical_dockwidget_titlebars') verttabs_box = newcb(_("Vertical tabs in panes"), 'vertical_tabs') animated_box = newcb(_("Animated toolbars and panes"), 'animated_docks') tear_off_box = newcb(_("Tear off menus"), 'tear_off_menus', tip=_("Set this to detach any<br> " "menu from the main window")) margin_box = newcb(_("Custom margin for panes:"), 'use_custom_margin') margin_spin = self.create_spinbox("", "pixels", 'custom_margin', 0, 0, 30) margin_box.toggled.connect(margin_spin.setEnabled) margin_spin.setEnabled(self.get_option('use_custom_margin')) margins_layout = QHBoxLayout() margins_layout.addWidget(margin_box) margins_layout.addWidget(margin_spin) prompt_box = newcb(_("Prompt when exiting"), 'prompt_on_exit') # Decide if it's possible to activate or not single instance mode if running_in_mac_app(): self.set_option("single_instance", True) single_instance_box.setEnabled(False) # Layout interface comboboxes_layout = QHBoxLayout() cbs_layout = QGridLayout() cbs_layout.addWidget(style_combo.label, 0, 0) cbs_layout.addWidget(style_combo.combobox, 0, 1) cbs_layout.addWidget(icons_combo.label, 1, 0) cbs_layout.addWidget(icons_combo.combobox, 1, 1) cbs_layout.addWidget(language_combo.label, 2, 0) cbs_layout.addWidget(language_combo.combobox, 2, 1) comboboxes_layout.addLayout(cbs_layout) comboboxes_layout.addStretch(1) interface_layout = QVBoxLayout() interface_layout.addLayout(comboboxes_layout) interface_layout.addWidget(single_instance_box) interface_layout.addWidget(vertdock_box) interface_layout.addWidget(verttabs_box) interface_layout.addWidget(animated_box) interface_layout.addWidget(tear_off_box) interface_layout.addLayout(margins_layout) interface_layout.addWidget(prompt_box) interface_group.setLayout(interface_layout) # --- Status bar sbar_group = QGroupBox(_("Status bar")) show_status_bar = newcb(_("Show status bar"), 'show_status_bar') memory_box = newcb(_("Show memory usage every"), 'memory_usage/enable', tip=self.main.mem_status.toolTip()) memory_spin = self.create_spinbox("", " ms", 'memory_usage/timeout', min_=100, max_=1000000, step=100) memory_box.toggled.connect(memory_spin.setEnabled) memory_spin.setEnabled(self.get_option('memory_usage/enable')) memory_box.setEnabled(self.main.mem_status.is_supported()) memory_spin.setEnabled(self.main.mem_status.is_supported()) cpu_box = newcb(_("Show CPU usage every"), 'cpu_usage/enable', tip=self.main.cpu_status.toolTip()) cpu_spin = self.create_spinbox("", " ms", 'cpu_usage/timeout', min_=100, max_=1000000, step=100) cpu_box.toggled.connect(cpu_spin.setEnabled) cpu_spin.setEnabled(self.get_option('cpu_usage/enable')) cpu_box.setEnabled(self.main.cpu_status.is_supported()) cpu_spin.setEnabled(self.main.cpu_status.is_supported()) status_bar_o = self.get_option('show_status_bar') show_status_bar.toggled.connect(memory_box.setEnabled) show_status_bar.toggled.connect(memory_spin.setEnabled) show_status_bar.toggled.connect(cpu_box.setEnabled) show_status_bar.toggled.connect(cpu_spin.setEnabled) memory_box.setEnabled(status_bar_o) memory_spin.setEnabled(status_bar_o) cpu_box.setEnabled(status_bar_o) cpu_spin.setEnabled(status_bar_o) # Layout status bar cpu_memory_layout = QGridLayout() cpu_memory_layout.addWidget(memory_box, 0, 0) cpu_memory_layout.addWidget(memory_spin, 0, 1) cpu_memory_layout.addWidget(cpu_box, 1, 0) cpu_memory_layout.addWidget(cpu_spin, 1, 1) sbar_layout = QVBoxLayout() sbar_layout.addWidget(show_status_bar) sbar_layout.addLayout(cpu_memory_layout) sbar_group.setLayout(sbar_layout) # --- Debugging debug_group = QGroupBox(_("Debugging")) popup_console_box = newcb( _("Pop up internal console when internal " "errors appear"), 'show_internal_console_if_traceback') debug_layout = QVBoxLayout() debug_layout.addWidget(popup_console_box) debug_group.setLayout(debug_layout) # --- Spyder updates update_group = QGroupBox(_("Updates")) check_updates = newcb(_("Check for updates on startup"), 'check_updates_on_startup') update_layout = QVBoxLayout() update_layout.addWidget(check_updates) update_group.setLayout(update_layout) vlayout = QVBoxLayout() vlayout.addWidget(interface_group) vlayout.addWidget(sbar_group) vlayout.addWidget(debug_group) vlayout.addWidget(update_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): # Connections group connections_group = QGroupBox(_("Automatic connections")) connections_label = QLabel( _("This pane can automatically " "show an object's help information after " "a left parenthesis is written next to it. " "Below you can decide to which plugin " "you want to connect it to turn on this " "feature.")) connections_label.setWordWrap(True) editor_box = self.create_checkbox(_("Editor"), 'connect/editor') rope_installed = programs.is_module_installed('rope') jedi_installed = programs.is_module_installed('jedi', '>=0.8.1') editor_box.setEnabled(rope_installed or jedi_installed) if not rope_installed and not jedi_installed: editor_tip = _( "This feature requires the Rope or Jedi libraries.\n" "It seems you don't have either installed.") editor_box.setToolTip(editor_tip) python_box = self.create_checkbox(_("Python Console"), 'connect/python_console') ipython_box = self.create_checkbox(_("IPython Console"), 'connect/ipython_console') ipython_box.setEnabled(QTCONSOLE_INSTALLED) connections_layout = QVBoxLayout() connections_layout.addWidget(connections_label) connections_layout.addWidget(editor_box) connections_layout.addWidget(python_box) connections_layout.addWidget(ipython_box) connections_group.setLayout(connections_layout) # Features group features_group = QGroupBox(_("Additional features")) math_box = self.create_checkbox(_("Render mathematical equations"), 'math') req_sphinx = programs.is_module_installed('sphinx', '>=1.1') math_box.setEnabled(req_sphinx) if not req_sphinx: sphinx_ver = programs.get_module_version('sphinx') sphinx_tip = _("This feature requires Sphinx 1.1 or superior.") sphinx_tip += "\n" + _( "Sphinx %s is currently installed.") % sphinx_ver math_box.setToolTip(sphinx_tip) features_layout = QVBoxLayout() features_layout.addWidget(math_box) features_group.setLayout(features_layout) # Source code group sourcecode_group = QGroupBox(_("Source code")) wrap_mode_box = self.create_checkbox(_("Wrap lines"), 'wrap') sourcecode_layout = QVBoxLayout() sourcecode_layout.addWidget(wrap_mode_box) sourcecode_group.setLayout(sourcecode_layout) # Final layout vlayout = QVBoxLayout() vlayout.addWidget(connections_group) vlayout.addWidget(features_group) vlayout.addWidget(sourcecode_group) vlayout.addStretch(1) self.setLayout(vlayout)
def __init__(self, parent, max_entries=100): "Initialize Various list objects before assignment" displaylist = [] displaynamelist = [] infixmod = [] infixlist = [] desclist = [] parameternamelist = [] parameterdesclist = [] parameterstringlist = [] paramcountlist = [] buttonlist = [] xmldoc = minidom.parse('C:\\Users\\Jayit\\.spyder2\\ratelaw2_0_3.xml') #xmldoc = minidom.parse('%\\Downloads\\ratelaw2_0_3.xml') lawlistxml = xmldoc.getElementsByTagName('law') o = 0 for s in lawlistxml: o = o + 1 parameternamelistlist = [0 for x in range(o)] parameterdesclistlist = [0 for x in range(o)] """i is the number of laws currently in the xml file""" i = 0 """ Parsing xml: Acquiring rate law name, description, and list of parameter information """ for s in lawlistxml: #RATE_LAW_MESSAGE += s.getAttribute('displayName') + "\n" """Gets Latec Expression""" displaylist.append(s.getAttribute('display')) """Gets Rate-Law Name""" displaynamelist.append(s.getAttribute('displayName')) """"Gets Raw Rate-Law expression""" infixlist.append(s.getAttribute('infixExpression')) """Gets description statement""" desclist.append(s.getAttribute('description')) """Gets listOfParameters Object""" parameterlist = s.getElementsByTagName('listOfParameters')[0] """Gets a list of parameters within ListOfParameters object""" parameters = parameterlist.getElementsByTagName('parameter') for param in parameters: parameternamelist.append(param.attributes['name'].value) #print(param.attributes['name'].value) parameterdesclist.append(param.attributes['description'].value) parameternamelistlist[i] = parameternamelist #print("break") parameterdesclistlist[i] = parameterdesclist parameternamelist = [] parameterdesclist = [] i = i + 1 SLElistlist = [ 0 for x in range(i)] PLElistlist = [ 0 for x in range(i)] ILElistlist = [ 0 for x in range(i)] paramLElistlist = [ 0 for x in range(i)] numlistlist = [ 0 for x in range(i)] QWidget.__init__(self, parent) self.setWindowTitle("Rate Law Library") self.output = None self.error_output = None self._last_wdir = None self._last_args = None self._last_pythonpath = None #self.textlabel = QLabel(RATE_LAW_MESSAGE) self.lawlist = QListWidget() self.lawpage = QStackedWidget() index = 0 for j in range(i): item = QListWidgetItem(displaynamelist[j]) self.lawlist.addItem(item) self.lawdetailpage = QWidget() setup_group = QGroupBox(displaynamelist[j]) infixmod.append(infixlist[j].replace("___"," ")) setup_label = QLabel(infixmod[j]) setup_label.setWordWrap(True) desc_group = QGroupBox("Description") desc_label = QLabel(desclist[j]) desc_label.setWordWrap(True) param_label = QGridLayout() nm = QLabel("Name:") des = QLabel("Description:") repl = QLabel("Replace with:") param_label.addWidget(nm,0,0) param_label.addWidget(des,0,1) param_label.addWidget(repl,0,2) """g is the total number of alterable values""" g = 0 """t is the total number of alterable non-parameters""" t = 1 snum = 0 pnum = 0 inum = 0 """range of N is the max number of possible substrates OR products""" N = 5 for n in range(N): nl = n+1 if (infixmod[j].find('S%s' % nl) > -1): z = QLabel('S%s is present' % nl) param_label.addWidget(z,t,0) snum = snum + 1 t = t + 1 for n in range(N): nl = n+1 if (infixmod[j].find('P%s' % nl) > -1): z = QLabel('P%s is present' % nl) param_label.addWidget(z,t,0) pnum = pnum + 1 t = t + 1 for n in range(N): nl = n+1 if (infixmod[j].find('I%s' % nl) > -1): z = QLabel('I%s is present' % nl) param_label.addWidget(z,t,0) inum = inum + 1 t = t + 1 """Initialize lists of list of parameter lineedit""" length = len(parameternamelistlist[j]) for b in range(length): p = QLabel("%s :" % parameternamelistlist[j][b]) param_label.addWidget(p,b+t,0) d = QLabel("'%s'" % parameterdesclistlist[j][b]) param_label.addWidget(d,b+t,1) g = t + length Slineeditlist = [0 for x in range(snum)] Plineeditlist = [0 for x in range(pnum)] Ilineeditlist = [0 for x in range(inum)] paramlineeditlist = [0 for x in range(length)] editcount = 1 """Place lineedit widgets for parameters""" for s in range(snum): Slineeditlist[s] = QLineEdit() param_label.addWidget(Slineeditlist[s],editcount,2) editcount = editcount + 1 SLElistlist[j] = Slineeditlist for s in range(pnum): Plineeditlist[s] = QLineEdit() param_label.addWidget(Plineeditlist[s],editcount,2) editcount = editcount + 1 PLElistlist[j] = Plineeditlist for s in range(inum): Ilineeditlist[s] = QLineEdit() param_label.addWidget(Ilineeditlist[s],editcount,2) editcount = editcount + 1 ILElistlist[j] = Ilineeditlist for s in range(length): paramlineeditlist[s] = QLineEdit() param_label.addWidget(paramlineeditlist[s],editcount,2) editcount = editcount + 1 paramLElistlist[j] = paramlineeditlist """Necessary lists for editable parameters. Housekeeping essentially.""" stuff = paramlineeditlist[0].text() numlistlist[j] = [snum, pnum, inum, length] charlist = ["S","P","I"] buttonlist.append(QPushButton(self)) buttonlist[j].setText("Insert Rate Law: %s" % displaynamelist[j]) # Warning: do not try to regroup the following QLabel contents with # widgets above -- this string was isolated here in a single QLabel # on purpose: to fix Issue 863 """Page formatting""" setup_layout = QVBoxLayout() setup_layout.addWidget(setup_label) setup_group.setLayout(setup_layout) desc_group.setLayout(param_label) vlayout = QVBoxLayout() vlayout.addWidget(setup_group) vlayout.addWidget(desc_group) vlayout.addWidget(buttonlist[j]) vlayout.addStretch(1) self.lawdetailpage.setLayout(vlayout) self.lawpage.addWidget(self.lawdetailpage) """Set up button functionality""" for k in range(47): buttonlist[k].clicked.connect(pressbutton(self, infixmod[k], SLElistlist[k], PLElistlist[k],ILElistlist[k], paramLElistlist[k], parameternamelistlist[k], numlistlist[k], charlist,k)) self.lawlist.currentRowChanged.connect(self.lawpage.setCurrentIndex) self.lawlist.setCurrentRow(0) """Set up high-level widget formatting.""" hsplitter = QSplitter() hsplitter.addWidget(self.lawlist) hsplitter.addWidget(self.lawpage) layout = QVBoxLayout() layout.addWidget(hsplitter) self.setLayout(layout)
def __init__(self, parent, opacity, duration, easing_curve): super(FadingTipBox, self).__init__(parent, opacity, duration, easing_curve) self.holder = self.anim # needed for qt to work self.parent = parent self.frames = None self.color_top = QColor.fromRgb(230, 230, 230) self.color_back = QColor.fromRgb(255, 255, 255) self.offset_shadow = 0 self.fixed_width = 300 self.key_pressed = None self.setAttribute(Qt.WA_TranslucentBackground) self.setWindowFlags(Qt.Dialog | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint) self.setModal(False) # Widgets self.button_home = QPushButton("<<") self.button_close = QPushButton("X") self.button_previous = QPushButton(" < ") self.button_end = QPushButton(">>") self.button_next = QPushButton(" > ") self.button_run = QPushButton(_('Run code')) self.button_disable = None self.button_current = QToolButton() self.label_image = QLabel() self.label_title = QLabel() self.combo_title = QComboBox() self.label_current = QLabel() self.label_content = QLabel() self.label_content.setMinimumWidth(self.fixed_width) self.label_content.setMaximumWidth(self.fixed_width) self.label_current.setAlignment(Qt.AlignCenter) self.label_content.setWordWrap(True) self.widgets = [ self.label_content, self.label_title, self.label_current, self.combo_title, self.button_close, self.button_run, self.button_next, self.button_previous, self.button_end, self.button_home, self.button_current ] arrow = get_image_path('hide.png') self.stylesheet = '''QPushButton { background-color: rgbs(200,200,200,100%); color: rgbs(0,0,0,100%); border-style: outset; border-width: 1px; border-radius: 3px; border-color: rgbs(100,100,100,100%); padding: 2px; } QPushButton:hover { background-color: rgbs(150, 150, 150, 100%); } QPushButton:disabled { background-color: rgbs(230,230,230,100%); color: rgbs(200,200,200,100%); border-color: rgbs(200,200,200,100%); } QComboBox { padding-left: 5px; background-color: rgbs(230,230,230,100%); border-width: 0px; border-radius: 0px; min-height:20px; max-height:20px; } QComboBox::drop-down { subcontrol-origin: padding; subcontrol-position: top left; border-width: 0px; } QComboBox::down-arrow { image: url(''' + arrow + '''); } ''' # Windows fix, slashes should be always in unix-style self.stylesheet = self.stylesheet.replace('\\', '/') for widget in self.widgets: widget.setFocusPolicy(Qt.NoFocus) widget.setStyleSheet(self.stylesheet) layout_top = QHBoxLayout() layout_top.addWidget(self.combo_title) layout_top.addStretch() layout_top.addWidget(self.button_close) layout_top.addSpacerItem( QSpacerItem(self.offset_shadow, self.offset_shadow)) layout_content = QHBoxLayout() layout_content.addWidget(self.label_content) layout_content.addWidget(self.label_image) layout_content.addSpacerItem(QSpacerItem(5, 5)) layout_run = QHBoxLayout() layout_run.addStretch() layout_run.addWidget(self.button_run) layout_run.addStretch() layout_run.addSpacerItem( QSpacerItem(self.offset_shadow, self.offset_shadow)) layout_navigation = QHBoxLayout() layout_navigation.addWidget(self.button_home) layout_navigation.addWidget(self.button_previous) layout_navigation.addStretch() layout_navigation.addWidget(self.label_current) layout_navigation.addStretch() layout_navigation.addWidget(self.button_next) layout_navigation.addWidget(self.button_end) layout_navigation.addSpacerItem( QSpacerItem(self.offset_shadow, self.offset_shadow)) layout = QVBoxLayout() layout.addLayout(layout_top) layout.addStretch() layout.addSpacerItem(QSpacerItem(15, 15)) layout.addLayout(layout_content) layout.addLayout(layout_run) layout.addStretch() layout.addSpacerItem(QSpacerItem(15, 15)) layout.addLayout(layout_navigation) layout.addSpacerItem( QSpacerItem(self.offset_shadow, self.offset_shadow)) layout.setSizeConstraint(QLayout.SetFixedSize) self.setLayout(layout) self.set_funcs_before_fade_in([self._disable_widgets]) self.set_funcs_after_fade_in([self._enable_widgets]) self.set_funcs_before_fade_out([self._disable_widgets]) self.setContextMenuPolicy(Qt.CustomContextMenu)
def __init__(self, parent, names, order, active): super(LayoutSettingsDialog, self).__init__(parent) # variables self._parent = parent self._selection_model = None self.names = names self.order = order self.active = active # widgets self.button_move_up = QPushButton(_('Move Up')) self.button_move_down = QPushButton(_('Move Down')) self.button_delete = QPushButton(_('Delete Layout')) self.button_box = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) self.group_box = QGroupBox(_("Layout Dispay and Order")) self.table = QTableView(self) self.ok_button = self.button_box.button(QDialogButtonBox.Ok) self.cancel_button = self.button_box.button(QDialogButtonBox.Cancel) self.cancel_button.setDefault(True) self.cancel_button.setAutoDefault(True) # widget setup self.dialog_size = QSize(300, 200) self.setMinimumSize(self.dialog_size) self.setFixedSize(self.dialog_size) self.setWindowTitle('Layout Settings') self.table.setModel(LayoutModel(self.table, order, active)) self.table.setSelectionBehavior(QAbstractItemView.SelectRows) self.table.setSelectionMode(QAbstractItemView.SingleSelection) self.table.verticalHeader().hide() self.table.horizontalHeader().hide() self.table.setAlternatingRowColors(True) self.table.setShowGrid(False) self.table.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.table.horizontalHeader().setStretchLastSection(True) self.table.setColumnHidden(1, True) # need to keep a reference for pyside not to segfault! self._selection_model = self.table.selectionModel() # layout buttons_layout = QVBoxLayout() buttons_layout.addWidget(self.button_move_up) buttons_layout.addWidget(self.button_move_down) buttons_layout.addStretch() buttons_layout.addWidget(self.button_delete) group_layout = QHBoxLayout() group_layout.addWidget(self.table) group_layout.addLayout(buttons_layout) self.group_box.setLayout(group_layout) layout = QVBoxLayout() layout.addWidget(self.group_box) layout.addWidget(self.button_box) self.setLayout(layout) # signals and slots self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.close) self.button_delete.clicked.connect(self.delete_layout) self.button_move_up.clicked.connect(lambda: self.move_layout(True)) self.button_move_down.clicked.connect(lambda: self.move_layout(False)) self.table.model().dataChanged.connect( lambda: self.selection_changed(None, None)) self._selection_model.selectionChanged.connect( lambda: self.selection_changed(None, None)) # focus table index = self.table.model().index(0, 0) self.table.setCurrentIndex(index) self.table.setFocus()
def setup_page(self): run_dlg = _("Run Settings") run_menu = _("Run") about_label = QLabel(_("The following are the default <i>%s</i>. "\ "These options may be overriden using the "\ "<b>%s</b> dialog box (see the <b>%s</b> menu)"\ ) % (run_dlg, run_dlg, run_menu)) about_label.setWordWrap(True) interpreter_group = QGroupBox(_("Console")) interpreter_bg = QButtonGroup(interpreter_group) self.current_radio = self.create_radiobutton(CURRENT_INTERPRETER, CURRENT_INTERPRETER_OPTION, True, button_group=interpreter_bg) self.dedicated_radio = self.create_radiobutton(DEDICATED_INTERPRETER, DEDICATED_INTERPRETER_OPTION, False, button_group=interpreter_bg) self.systerm_radio = self.create_radiobutton(SYSTERM_INTERPRETER, SYSTERM_INTERPRETER_OPTION, False, button_group=interpreter_bg) interpreter_layout = QVBoxLayout() interpreter_group.setLayout(interpreter_layout) interpreter_layout.addWidget(self.current_radio) interpreter_layout.addWidget(self.dedicated_radio) interpreter_layout.addWidget(self.systerm_radio) wdir_group = QGroupBox(_("Working directory")) wdir_bg = QButtonGroup(wdir_group) wdir_label = QLabel(_("Default working directory is:")) wdir_label.setWordWrap(True) dirname_radio = self.create_radiobutton(_("the script directory"), WDIR_USE_SCRIPT_DIR_OPTION, True, button_group=wdir_bg) thisdir_radio = self.create_radiobutton(_("the following directory:"), WDIR_USE_FIXED_DIR_OPTION, False, button_group=wdir_bg) thisdir_bd = self.create_browsedir("", WDIR_FIXED_DIR_OPTION, getcwd()) thisdir_radio.toggled.connect(thisdir_bd.setEnabled) dirname_radio.toggled.connect(thisdir_bd.setDisabled) thisdir_layout = QHBoxLayout() thisdir_layout.addWidget(thisdir_radio) thisdir_layout.addWidget(thisdir_bd) wdir_layout = QVBoxLayout() wdir_layout.addWidget(wdir_label) wdir_layout.addWidget(dirname_radio) wdir_layout.addLayout(thisdir_layout) wdir_group.setLayout(wdir_layout) firstrun_cb = self.create_checkbox( ALWAYS_OPEN_FIRST_RUN % _("Run Settings dialog"), ALWAYS_OPEN_FIRST_RUN_OPTION, False) vlayout = QVBoxLayout() vlayout.addWidget(about_label) vlayout.addSpacing(10) vlayout.addWidget(interpreter_group) vlayout.addWidget(wdir_group) vlayout.addWidget(firstrun_cb) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): # Fonts group plain_text_font_group = self.create_fontgroup(option=None, text=_("Plain text font style"), fontfilters=QFontComboBox.MonospacedFonts) rich_text_font_group = self.create_fontgroup(option='rich_text', text=_("Rich text font style")) # Connections group connections_group = QGroupBox(_("Automatic connections")) connections_label = QLabel(_("This pane can automatically " "show an object's help information after " "a left parenthesis is written next to it. " "Below you can decide to which plugin " "you want to connect it to turn on this " "feature.")) connections_label.setWordWrap(True) editor_box = self.create_checkbox(_("Editor"), 'connect/editor') rope_installed = programs.is_module_installed('rope') jedi_installed = programs.is_module_installed('jedi', '>=0.8.1') editor_box.setEnabled(rope_installed or jedi_installed) if not rope_installed and not jedi_installed: editor_tip = _("This feature requires the Rope or Jedi libraries.\n" "It seems you don't have either installed.") editor_box.setToolTip(editor_tip) python_box = self.create_checkbox(_("Python Console"), 'connect/python_console') ipython_box = self.create_checkbox(_("IPython Console"), 'connect/ipython_console') ipython_box.setEnabled(QTCONSOLE_INSTALLED) connections_layout = QVBoxLayout() connections_layout.addWidget(connections_label) connections_layout.addWidget(editor_box) connections_layout.addWidget(python_box) connections_layout.addWidget(ipython_box) connections_group.setLayout(connections_layout) # Features group features_group = QGroupBox(_("Additional features")) math_box = self.create_checkbox(_("Render mathematical equations"), 'math') req_sphinx = sphinx_version is not None and \ programs.is_module_installed('sphinx', '>=1.1') math_box.setEnabled(req_sphinx) if not req_sphinx: sphinx_tip = _("This feature requires Sphinx 1.1 or superior.") if sphinx_version is not None: sphinx_tip += "\n" + _("Sphinx %s is currently installed." ) % sphinx_version math_box.setToolTip(sphinx_tip) features_layout = QVBoxLayout() features_layout.addWidget(math_box) features_group.setLayout(features_layout) # Source code group sourcecode_group = QGroupBox(_("Source code")) wrap_mode_box = self.create_checkbox(_("Wrap lines"), 'wrap') names = CONF.get('color_schemes', 'names') choices = list(zip(names, names)) cs_combo = self.create_combobox(_("Syntax color scheme: "), choices, 'color_scheme_name') sourcecode_layout = QVBoxLayout() sourcecode_layout.addWidget(wrap_mode_box) sourcecode_layout.addWidget(cs_combo) sourcecode_group.setLayout(sourcecode_layout) # Final layout vlayout = QVBoxLayout() vlayout.addWidget(rich_text_font_group) vlayout.addWidget(plain_text_font_group) vlayout.addWidget(connections_group) vlayout.addWidget(features_group) vlayout.addWidget(sourcecode_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): newcb = self.create_checkbox # --- Interface interface_group = QGroupBox(_("Interface")) styles = [str(txt) for txt in list(QStyleFactory.keys())] choices = list(zip(styles, [style.lower() for style in styles])) style_combo = self.create_combobox(_('Qt windows style'), choices, 'windows_style', default=self.main.default_style) single_instance_box = newcb(_("Use a single instance"), 'single_instance', tip=_("Set this to open external<br> " "Python files in an already running " "instance (Requires a restart)")) vertdock_box = newcb(_("Vertical dockwidget title bars"), 'vertical_dockwidget_titlebars') verttabs_box = newcb(_("Vertical dockwidget tabs"), 'vertical_tabs') animated_box = newcb(_("Animated toolbars and dockwidgets"), 'animated_docks') tear_off_box = newcb(_("Tear off menus"), 'tear_off_menus', tip=_("Set this to detach any<br> " "menu from the main window")) margin_box = newcb(_("Custom dockwidget margin:"), 'use_custom_margin') margin_spin = self.create_spinbox("", "pixels", 'custom_margin', 0, 0, 30) self.connect(margin_box, SIGNAL("toggled(bool)"), margin_spin.setEnabled) margin_spin.setEnabled(self.get_option('use_custom_margin')) margins_layout = QHBoxLayout() margins_layout.addWidget(margin_box) margins_layout.addWidget(margin_spin) # Decide if it's possible to activate or not singie instance mode if sys.platform == "darwin" and 'Spyder.app' in __file__: self.set_option("single_instance", True) single_instance_box.setEnabled(False) interface_layout = QVBoxLayout() interface_layout.addWidget(style_combo) interface_layout.addWidget(single_instance_box) interface_layout.addWidget(vertdock_box) interface_layout.addWidget(verttabs_box) interface_layout.addWidget(animated_box) interface_layout.addWidget(tear_off_box) interface_layout.addLayout(margins_layout) interface_group.setLayout(interface_layout) # --- Status bar sbar_group = QGroupBox(_("Status bar")) memory_box = newcb(_("Show memory usage every"), 'memory_usage/enable', tip=self.main.mem_status.toolTip()) memory_spin = self.create_spinbox("", " ms", 'memory_usage/timeout', min_=100, max_=1000000, step=100) self.connect(memory_box, SIGNAL("toggled(bool)"), memory_spin.setEnabled) memory_spin.setEnabled(self.get_option('memory_usage/enable')) memory_layout = QHBoxLayout() memory_layout.addWidget(memory_box) memory_layout.addWidget(memory_spin) memory_layout.setEnabled(self.main.mem_status.is_supported()) cpu_box = newcb(_("Show CPU usage every"), 'cpu_usage/enable', tip=self.main.cpu_status.toolTip()) cpu_spin = self.create_spinbox("", " ms", 'cpu_usage/timeout', min_=100, max_=1000000, step=100) self.connect(cpu_box, SIGNAL("toggled(bool)"), cpu_spin.setEnabled) cpu_spin.setEnabled(self.get_option('cpu_usage/enable')) cpu_layout = QHBoxLayout() cpu_layout.addWidget(cpu_box) cpu_layout.addWidget(cpu_spin) cpu_layout.setEnabled(self.main.cpu_status.is_supported()) sbar_layout = QVBoxLayout() sbar_layout.addLayout(memory_layout) sbar_layout.addLayout(cpu_layout) sbar_group.setLayout(sbar_layout) # --- Debugging debug_group = QGroupBox(_("Debugging")) popup_console_box = newcb(_("Pop up internal console when internal " "errors appear"), 'show_internal_console_if_traceback') debug_layout = QVBoxLayout() debug_layout.addWidget(popup_console_box) debug_group.setLayout(debug_layout) vlayout = QVBoxLayout() vlayout.addWidget(interface_group) vlayout.addWidget(sbar_group) vlayout.addWidget(debug_group) vlayout.addStretch(1) self.setLayout(vlayout)
def __init__(self, parent, max_entries=100): "Initialize Various list objects before assignment" displaylist = [] displaynamelist = [] infixmod = [] infixlist = [] desclist = [] parameternamelist = [] parameterdesclist = [] parameterstringlist = [] paramcountlist = [] buttonlist = [] xmldoc = minidom.parse('C:\\Users\\Jayit\\.spyder2\\ratelaw2_0_3.xml') #xmldoc = minidom.parse('%\\Downloads\\ratelaw2_0_3.xml') lawlistxml = xmldoc.getElementsByTagName('law') o = 0 for s in lawlistxml: o = o + 1 parameternamelistlist = [0 for x in range(o)] parameterdesclistlist = [0 for x in range(o)] """i is the number of laws currently in the xml file""" i = 0 """ Parsing xml: Acquiring rate law name, description, and list of parameter information """ for s in lawlistxml: #RATE_LAW_MESSAGE += s.getAttribute('displayName') + "\n" """Gets Latec Expression""" displaylist.append(s.getAttribute('display')) """Gets Rate-Law Name""" displaynamelist.append(s.getAttribute('displayName')) """"Gets Raw Rate-Law expression""" infixlist.append(s.getAttribute('infixExpression')) """Gets description statement""" desclist.append(s.getAttribute('description')) """Gets listOfParameters Object""" parameterlist = s.getElementsByTagName('listOfParameters')[0] """Gets a list of parameters within ListOfParameters object""" parameters = parameterlist.getElementsByTagName('parameter') for param in parameters: parameternamelist.append(param.attributes['name'].value) #print(param.attributes['name'].value) parameterdesclist.append(param.attributes['description'].value) parameternamelistlist[i] = parameternamelist #print("break") parameterdesclistlist[i] = parameterdesclist parameternamelist = [] parameterdesclist = [] i = i + 1 SLElistlist = [0 for x in range(i)] PLElistlist = [0 for x in range(i)] ILElistlist = [0 for x in range(i)] paramLElistlist = [0 for x in range(i)] numlistlist = [0 for x in range(i)] QWidget.__init__(self, parent) self.setWindowTitle("Rate Law Library") self.output = None self.error_output = None self._last_wdir = None self._last_args = None self._last_pythonpath = None #self.textlabel = QLabel(RATE_LAW_MESSAGE) self.lawlist = QListWidget() self.lawpage = QStackedWidget() index = 0 for j in range(i): item = QListWidgetItem(displaynamelist[j]) self.lawlist.addItem(item) self.lawdetailpage = QWidget() setup_group = QGroupBox(displaynamelist[j]) infixmod.append(infixlist[j].replace("___", " ")) setup_label = QLabel(infixmod[j]) setup_label.setWordWrap(True) desc_group = QGroupBox("Description") desc_label = QLabel(desclist[j]) desc_label.setWordWrap(True) param_label = QGridLayout() nm = QLabel("Name:") des = QLabel("Description:") repl = QLabel("Replace with:") param_label.addWidget(nm, 0, 0) param_label.addWidget(des, 0, 1) param_label.addWidget(repl, 0, 2) """g is the total number of alterable values""" g = 0 """t is the total number of alterable non-parameters""" t = 1 snum = 0 pnum = 0 inum = 0 """range of N is the max number of possible substrates OR products""" N = 5 for n in range(N): nl = n + 1 if (infixmod[j].find('S%s' % nl) > -1): z = QLabel('S%s is present' % nl) param_label.addWidget(z, t, 0) snum = snum + 1 t = t + 1 for n in range(N): nl = n + 1 if (infixmod[j].find('P%s' % nl) > -1): z = QLabel('P%s is present' % nl) param_label.addWidget(z, t, 0) pnum = pnum + 1 t = t + 1 for n in range(N): nl = n + 1 if (infixmod[j].find('I%s' % nl) > -1): z = QLabel('I%s is present' % nl) param_label.addWidget(z, t, 0) inum = inum + 1 t = t + 1 """Initialize lists of list of parameter lineedit""" length = len(parameternamelistlist[j]) for b in range(length): p = QLabel("%s :" % parameternamelistlist[j][b]) param_label.addWidget(p, b + t, 0) d = QLabel("'%s'" % parameterdesclistlist[j][b]) param_label.addWidget(d, b + t, 1) g = t + length Slineeditlist = [0 for x in range(snum)] Plineeditlist = [0 for x in range(pnum)] Ilineeditlist = [0 for x in range(inum)] paramlineeditlist = [0 for x in range(length)] editcount = 1 """Place lineedit widgets for parameters""" for s in range(snum): Slineeditlist[s] = QLineEdit() param_label.addWidget(Slineeditlist[s], editcount, 2) editcount = editcount + 1 SLElistlist[j] = Slineeditlist for s in range(pnum): Plineeditlist[s] = QLineEdit() param_label.addWidget(Plineeditlist[s], editcount, 2) editcount = editcount + 1 PLElistlist[j] = Plineeditlist for s in range(inum): Ilineeditlist[s] = QLineEdit() param_label.addWidget(Ilineeditlist[s], editcount, 2) editcount = editcount + 1 ILElistlist[j] = Ilineeditlist for s in range(length): paramlineeditlist[s] = QLineEdit() param_label.addWidget(paramlineeditlist[s], editcount, 2) editcount = editcount + 1 paramLElistlist[j] = paramlineeditlist """Necessary lists for editable parameters. Housekeeping essentially.""" stuff = paramlineeditlist[0].text() numlistlist[j] = [snum, pnum, inum, length] charlist = ["S", "P", "I"] buttonlist.append(QPushButton(self)) buttonlist[j].setText("Insert Rate Law: %s" % displaynamelist[j]) # Warning: do not try to regroup the following QLabel contents with # widgets above -- this string was isolated here in a single QLabel # on purpose: to fix Issue 863 """Page formatting""" setup_layout = QVBoxLayout() setup_layout.addWidget(setup_label) setup_group.setLayout(setup_layout) desc_group.setLayout(param_label) vlayout = QVBoxLayout() vlayout.addWidget(setup_group) vlayout.addWidget(desc_group) vlayout.addWidget(buttonlist[j]) vlayout.addStretch(1) self.lawdetailpage.setLayout(vlayout) self.lawpage.addWidget(self.lawdetailpage) """Set up button functionality""" for k in range(47): buttonlist[k].clicked.connect( pressbutton(self, infixmod[k], SLElistlist[k], PLElistlist[k], ILElistlist[k], paramLElistlist[k], parameternamelistlist[k], numlistlist[k], charlist, k)) self.lawlist.currentRowChanged.connect(self.lawpage.setCurrentIndex) self.lawlist.setCurrentRow(0) """Set up high-level widget formatting.""" hsplitter = QSplitter() hsplitter.addWidget(self.lawlist) hsplitter.addWidget(self.lawpage) layout = QVBoxLayout() layout.addWidget(hsplitter) self.setLayout(layout)
def setup_page(self): about_label = QLabel(_("The <b>global working directory</b> is " "the working directory for newly opened <i>consoles</i> " "(Python/IPython consoles and terminals), for the " "<i>file explorer</i>, for the <i>find in files</i> " "plugin and for new files created in the <i>editor</i>.")) about_label.setWordWrap(True) startup_group = QGroupBox(_("Startup")) startup_bg = QButtonGroup(startup_group) startup_label = QLabel(_("At startup, the global working " "directory is:")) startup_label.setWordWrap(True) lastdir_radio = self.create_radiobutton( _("the same as in last session"), 'startup/use_last_directory', True, _("At startup, Spyder will restore the " "global directory from last session"), button_group=startup_bg) thisdir_radio = self.create_radiobutton( _("the following directory:"), 'startup/use_fixed_directory', False, _("At startup, the global working " "directory will be the specified path"), button_group=startup_bg) thisdir_bd = self.create_browsedir("", 'startup/fixed_directory', getcwd()) self.connect(thisdir_radio, SIGNAL("toggled(bool)"), thisdir_bd.setEnabled) self.connect(lastdir_radio, SIGNAL("toggled(bool)"), thisdir_bd.setDisabled) thisdir_layout = QHBoxLayout() thisdir_layout.addWidget(thisdir_radio) thisdir_layout.addWidget(thisdir_bd) editor_o_group = QGroupBox(_("Open file")) editor_o_label = QLabel(_("Files are opened from:")) editor_o_label.setWordWrap(True) editor_o_bg = QButtonGroup(editor_o_group) editor_o_radio1 = self.create_radiobutton( _("the current file directory"), 'editor/open/browse_scriptdir', button_group=editor_o_bg) editor_o_radio2 = self.create_radiobutton( _("the global working directory"), 'editor/open/browse_workdir', button_group=editor_o_bg) editor_n_group = QGroupBox(_("New file")) editor_n_label = QLabel(_("Files are created in:")) editor_n_label.setWordWrap(True) editor_n_bg = QButtonGroup(editor_n_group) editor_n_radio1 = self.create_radiobutton( _("the current file directory"), 'editor/new/browse_scriptdir', button_group=editor_n_bg) editor_n_radio2 = self.create_radiobutton( _("the global working directory"), 'editor/new/browse_workdir', button_group=editor_n_bg) # Note: default values for the options above are set in plugin's # constructor (see below) other_group = QGroupBox(_("Change to file base directory")) newcb = self.create_checkbox open_box = newcb(_("When opening a file"), 'editor/open/auto_set_to_basedir') save_box = newcb(_("When saving a file"), 'editor/save/auto_set_to_basedir') startup_layout = QVBoxLayout() startup_layout.addWidget(startup_label) startup_layout.addWidget(lastdir_radio) startup_layout.addLayout(thisdir_layout) startup_group.setLayout(startup_layout) editor_o_layout = QVBoxLayout() editor_o_layout.addWidget(editor_o_label) editor_o_layout.addWidget(editor_o_radio1) editor_o_layout.addWidget(editor_o_radio2) editor_o_group.setLayout(editor_o_layout) editor_n_layout = QVBoxLayout() editor_n_layout.addWidget(editor_n_label) editor_n_layout.addWidget(editor_n_radio1) editor_n_layout.addWidget(editor_n_radio2) editor_n_group.setLayout(editor_n_layout) other_layout = QVBoxLayout() other_layout.addWidget(open_box) other_layout.addWidget(save_box) other_group.setLayout(other_layout) vlayout = QVBoxLayout() vlayout.addWidget(about_label) vlayout.addSpacing(10) vlayout.addWidget(startup_group) vlayout.addWidget(editor_o_group) vlayout.addWidget(editor_n_group) vlayout.addWidget(other_group) vlayout.addStretch(1) self.setLayout(vlayout)
def __init__(self, parent, names, order, active): super(LayoutSettingsDialog, self).__init__(parent) # variables self._parent = parent self._selection_model = None self.names = names self.order = order self.active = active # widgets self.button_move_up = QPushButton(_('Move Up')) self.button_move_down = QPushButton(_('Move Down')) self.button_delete = QPushButton(_('Delete Layout')) self.button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) self.group_box = QGroupBox(_("Layout Dispay and Order")) self.table = QTableView(self) self.ok_button = self.button_box.button(QDialogButtonBox.Ok) self.cancel_button = self.button_box.button(QDialogButtonBox.Cancel) self.cancel_button.setDefault(True) self.cancel_button.setAutoDefault(True) # widget setup self.dialog_size = QSize(300, 200) self.setMinimumSize(self.dialog_size) self.setFixedSize(self.dialog_size) self.setWindowTitle('Layout Settings') self.table.setModel(LayoutModel(self.table, order, active)) self.table.setSelectionBehavior(QAbstractItemView.SelectRows) self.table.setSelectionMode(QAbstractItemView.SingleSelection) self.table.verticalHeader().hide() self.table.horizontalHeader().hide() self.table.setAlternatingRowColors(True) self.table.setShowGrid(False) self.table.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.table.horizontalHeader().setStretchLastSection(True) self.table.setColumnHidden(1, True) # need to keep a reference for pyside not to segfault! self._selection_model = self.table.selectionModel() # layout buttons_layout = QVBoxLayout() buttons_layout.addWidget(self.button_move_up) buttons_layout.addWidget(self.button_move_down) buttons_layout.addStretch() buttons_layout.addWidget(self.button_delete) group_layout = QHBoxLayout() group_layout.addWidget(self.table) group_layout.addLayout(buttons_layout) self.group_box.setLayout(group_layout) layout = QVBoxLayout() layout.addWidget(self.group_box) layout.addWidget(self.button_box) self.setLayout(layout) # signals and slots self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.close) self.button_delete.clicked.connect(self.delete_layout) self.button_move_up.clicked.connect(lambda: self.move_layout(True)) self.button_move_down.clicked.connect(lambda: self.move_layout(False)) self.table.model().dataChanged.connect( lambda: self.selection_changed(None, None)) self._selection_model.selectionChanged.connect( lambda: self.selection_changed(None, None)) # focus table index = self.table.model().index(0, 0) self.table.setCurrentIndex(index) self.table.setFocus()
def __init__(self, parent, max_entries=100): """ Creates a very basic window with some text """ """ RATE_LAW_MESSAGE = \ "The Plugins for Spyder consists out of three main classes: \n\n" \ "1. HelloWorld\n\n" \ "\tThe HelloWorld class inherits all its methods from\n" \ "\tSpyderPluginMixin and the HelloWorldWidget and performs all\n" \ "\tthe processing required by the GU. \n\n" \ "2. HelloWorldConfigPage\n\n" \ "\tThe HelloWorldConfig class inherits all its methods from\n" \ "\tPluginConfigPage to create a configuration page that can be\n" \ "\tfound under Tools -> Preferences\n\n" \ "3. HelloWorldWidget\n\n" \ "\tThe HelloWorldWidget class inherits all its methods from\n" \ "\tQWidget to create the actual plugin GUI interface that \n" \ "\tdisplays this message on screen\n\n" """ #Testing access editor on plugin initialization RATE_LAW_MESSAGE = "" displaynamelist = [] #displaylist = [] infixlist = [] desclist = [] parameterstringlist = [] xmldoc = minidom.parse('\\.spyder2\\ratelaw2_0_3.xml') #xmldoc = minidom.parse('%\\Downloads\\ratelaw2_0_3.xml') lawlistxml = xmldoc.getElementsByTagName('law') #i is the number of laws currently in the xml file i = 0 """ Parsing xml: Acquiring rate law name, description, and list of parameter information """ for s in lawlistxml: #RATE_LAW_MESSAGE += s.getAttribute('displayName') + "\n" RATE_LAW_MESSAGE += s.getAttribute('display') + "\n" #displaynamelist[i] = s.getAttribute('displayName') #displaylist[i] = s.getAttribute('display') displaynamelist.append(s.getAttribute('displayName')) #displaylist.append(s.getAttribute('display')) infixlist.append(s.getAttribute('infixExpression')) desclist.append(s.getAttribute('description')) parameterlist = s.getElementsByTagName('listOfParameters')[0] #for p in parameterlist parameters = parameterlist.getElementsByTagName('parameter') parameterstring = "" for param in parameters: parametername = param.attributes['name'].value parameterdesc = param.attributes['description'].value parameterstring = parameterstring + '\t' + parametername + ":" + '\t' + " " + parameterdesc + "\n" """Creates "description" string""" #print('\t' + parametername + ":" + '\t' + parameterdesc) parameterstringlist.append(parameterstring) i = i + 1 QWidget.__init__(self, parent) self.setWindowTitle("Rate Law Library") self.output = None self.error_output = None self._last_wdir = None self._last_args = None self._last_pythonpath = None self.textlabel = QLabel(RATE_LAW_MESSAGE) self.lawlist = QListWidget() self.lawpage = QStackedWidget() #Adding displayName items to lawlist for j in range(i): item = QListWidgetItem(displaynamelist[j]) """Creates list entry for each rate law""" self.lawlist.addItem(item) """Adds rate law to list""" self.lawdetailpage = QWidget() """Creates page for each rate law""" # Page layout will become its own function setup_group = QGroupBox(displaynamelist[j]) """Creates box with rate law name as title""" infixmod = infixlist[j].replace("___"," ") setup_label = QLabel(infixmod) setup_label.setWordWrap(True) """types rate law expression, removing underscores""" desc_group = QGroupBox("Description") """creates box for description""" desc_label = QLabel(desclist[j]) desc_label.setWordWrap(True) param_label = QLabel(parameterstringlist[j]) param_label.setWordWrap(True) # Warning: do not try to regroup the following QLabel contents with # widgets above -- this string was isolated here in a single QLabel # on purpose: to fix Issue 863 setup_layout = QVBoxLayout() setup_layout.addWidget(setup_label) setup_group.setLayout(setup_layout) desc_layout = QVBoxLayout() desc_layout.addWidget(desc_label) desc_layout.addWidget(param_label) desc_group.setLayout(desc_layout) vlayout = QVBoxLayout() vlayout.addWidget(setup_group) vlayout.addWidget(desc_group) vlayout.addStretch(1) self.lawdetailpage.setLayout(vlayout) self.lawpage.addWidget(self.lawdetailpage) """Formats the page shown when a rate law is selected""" #self.connect(self.lawlist, SIGNAL(self.lawlist.currentRowChanged(int)),self.lawpage,SLOT(self.lawpage.setCurrentIndex(int))) self.lawlist.currentRowChanged.connect(self.lawpage.setCurrentIndex) """When a rate law in the list is clicked, its corresponding page is shown""" ''' self.lawpage = QWidget() ''' self.lawlist.setCurrentRow(0) hsplitter = QSplitter() hsplitter.addWidget(self.lawlist) "Adds list to left side of window" hlayout1 = QHBoxLayout() hlayout1.addWidget(self.textlabel) hlayout1.addStretch() self.lawpage.setLayout(hlayout1) hsplitter.addWidget(self.lawpage) """Adds law page to left side of window""" layout = QVBoxLayout() layout.addWidget(hsplitter) self.setLayout(layout)
def setup_page(self): newcb = self.create_checkbox # --- Interface interface_group = QGroupBox(_("Interface")) styles = [str(txt) for txt in list(QStyleFactory.keys())] choices = list(zip(styles, [style.lower() for style in styles])) style_combo = self.create_combobox(_('Qt windows style'), choices, 'windows_style', default=self.main.default_style) single_instance_box = newcb(_("Use a single instance"), 'single_instance', tip=_("Set this to open external<br> " "Python files in an already running " "instance (Requires a restart)")) vertdock_box = newcb(_("Vertical dockwidget title bars"), 'vertical_dockwidget_titlebars') verttabs_box = newcb(_("Vertical dockwidget tabs"), 'vertical_tabs') animated_box = newcb(_("Animated toolbars and dockwidgets"), 'animated_docks') tear_off_box = newcb(_("Tear off menus"), 'tear_off_menus', tip=_("Set this to detach any<br> " "menu from the main window")) margin_box = newcb(_("Custom dockwidget margin:"), 'use_custom_margin') margin_spin = self.create_spinbox("", "pixels", 'custom_margin', 0, 0, 30) self.connect(margin_box, SIGNAL("toggled(bool)"), margin_spin.setEnabled) margin_spin.setEnabled(self.get_option('use_custom_margin')) margins_layout = QHBoxLayout() margins_layout.addWidget(margin_box) margins_layout.addWidget(margin_spin) # Decide if it's possible to activate or not singie instance mode if sys.platform == "darwin" and 'Spyder.app' in __file__: self.set_option("single_instance", True) single_instance_box.setEnabled(False) interface_layout = QVBoxLayout() interface_layout.addWidget(style_combo) interface_layout.addWidget(single_instance_box) interface_layout.addWidget(vertdock_box) interface_layout.addWidget(verttabs_box) interface_layout.addWidget(animated_box) interface_layout.addWidget(tear_off_box) interface_layout.addLayout(margins_layout) interface_group.setLayout(interface_layout) # --- Status bar sbar_group = QGroupBox(_("Status bar")) memory_box = newcb(_("Show memory usage every"), 'memory_usage/enable', tip=self.main.mem_status.toolTip()) memory_spin = self.create_spinbox("", " ms", 'memory_usage/timeout', min_=100, max_=1000000, step=100) self.connect(memory_box, SIGNAL("toggled(bool)"), memory_spin.setEnabled) memory_spin.setEnabled(self.get_option('memory_usage/enable')) memory_layout = QHBoxLayout() memory_layout.addWidget(memory_box) memory_layout.addWidget(memory_spin) memory_layout.setEnabled(self.main.mem_status.is_supported()) cpu_box = newcb(_("Show CPU usage every"), 'cpu_usage/enable', tip=self.main.cpu_status.toolTip()) cpu_spin = self.create_spinbox("", " ms", 'cpu_usage/timeout', min_=100, max_=1000000, step=100) self.connect(cpu_box, SIGNAL("toggled(bool)"), cpu_spin.setEnabled) cpu_spin.setEnabled(self.get_option('cpu_usage/enable')) cpu_layout = QHBoxLayout() cpu_layout.addWidget(cpu_box) cpu_layout.addWidget(cpu_spin) cpu_layout.setEnabled(self.main.cpu_status.is_supported()) sbar_layout = QVBoxLayout() sbar_layout.addLayout(memory_layout) sbar_layout.addLayout(cpu_layout) sbar_group.setLayout(sbar_layout) # --- Debugging debug_group = QGroupBox(_("Debugging")) popup_console_box = newcb( _("Pop up internal console when internal " "errors appear"), 'show_internal_console_if_traceback') debug_layout = QVBoxLayout() debug_layout.addWidget(popup_console_box) debug_group.setLayout(debug_layout) vlayout = QVBoxLayout() vlayout.addWidget(interface_group) vlayout.addWidget(sbar_group) vlayout.addWidget(debug_group) vlayout.addStretch(1) self.setLayout(vlayout)
def setup_page(self): run_dlg = _("Run Settings") run_menu = _("Run") about_label = QLabel(_("The following are the default <i>%s</i>. "\ "These options may be overriden using the "\ "<b>%s</b> dialog box (see the <b>%s</b> menu)"\ ) % (run_dlg, run_dlg, run_menu)) about_label.setWordWrap(True) interpreter_group = QGroupBox(_("Console")) interpreter_bg = QButtonGroup(interpreter_group) self.current_radio = self.create_radiobutton( CURRENT_INTERPRETER, CURRENT_INTERPRETER_OPTION, True, button_group=interpreter_bg) self.dedicated_radio = self.create_radiobutton( DEDICATED_INTERPRETER, DEDICATED_INTERPRETER_OPTION, False, button_group=interpreter_bg) self.systerm_radio = self.create_radiobutton( SYSTERM_INTERPRETER, SYSTERM_INTERPRETER_OPTION, False, button_group=interpreter_bg) interpreter_layout = QVBoxLayout() interpreter_group.setLayout(interpreter_layout) interpreter_layout.addWidget(self.current_radio) interpreter_layout.addWidget(self.dedicated_radio) interpreter_layout.addWidget(self.systerm_radio) general_group = QGroupBox("General settings") wdir_bg = QButtonGroup(general_group) wdir_label = QLabel(_("Default working directory is:")) wdir_label.setWordWrap(True) dirname_radio = self.create_radiobutton(_("the script directory"), WDIR_USE_SCRIPT_DIR_OPTION, True, button_group=wdir_bg) thisdir_radio = self.create_radiobutton(_("the following directory:"), WDIR_USE_FIXED_DIR_OPTION, False, button_group=wdir_bg) thisdir_bd = self.create_browsedir("", WDIR_FIXED_DIR_OPTION, getcwd()) thisdir_radio.toggled.connect(thisdir_bd.setEnabled) dirname_radio.toggled.connect(thisdir_bd.setDisabled) thisdir_layout = QHBoxLayout() thisdir_layout.addWidget(thisdir_radio) thisdir_layout.addWidget(thisdir_bd) post_mortem = self.create_checkbox( _("Enter debugging mode when errors appear during execution"), 'post_mortem', False) general_layout = QVBoxLayout() general_layout.addWidget(wdir_label) general_layout.addWidget(dirname_radio) general_layout.addLayout(thisdir_layout) general_layout.addWidget(post_mortem) general_group.setLayout(general_layout) dedicated_group = QGroupBox(_("Dedicated Python console")) interact_after = self.create_checkbox( _("Interact with the Python console after execution"), 'interact', False) show_warning = self.create_checkbox( _("Show warning when killing running processes"), 'show_kill_warning', True) dedicated_layout = QVBoxLayout() dedicated_layout.addWidget(interact_after) dedicated_layout.addWidget(show_warning) dedicated_group.setLayout(dedicated_layout) firstrun_cb = self.create_checkbox( ALWAYS_OPEN_FIRST_RUN % _("Run Settings dialog"), ALWAYS_OPEN_FIRST_RUN_OPTION, False) vlayout = QVBoxLayout() vlayout.addWidget(about_label) vlayout.addSpacing(10) vlayout.addWidget(interpreter_group) vlayout.addWidget(general_group) vlayout.addWidget(dedicated_group) vlayout.addWidget(firstrun_cb) vlayout.addStretch(1) self.setLayout(vlayout)
def __init__(self, parent, opacity, duration, easing_curve): super(FadingTipBox, self).__init__(parent, opacity, duration, easing_curve) self.holder = self.anim # needed for qt to work self.parent = parent self.frames = None self.color_top = QColor.fromRgb(230, 230, 230) self.color_back = QColor.fromRgb(255, 255, 255) self.offset_shadow = 0 self.fixed_width = 300 self.key_pressed = None self.setAttribute(Qt.WA_TranslucentBackground) self.setWindowFlags(Qt.Dialog | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint) self.setModal(False) # Widgets self.button_home = QPushButton("<<") self.button_close = QPushButton("X") self.button_previous = QPushButton(" < ") self.button_end = QPushButton(">>") self.button_next = QPushButton(" > ") self.button_run = QPushButton(_('Run code')) self.button_disable = None self.button_current = QToolButton() self.label_image = QLabel() self.label_title = QLabel() self.combo_title = QComboBox() self.label_current = QLabel() self.label_content = QLabel() self.label_content.setMinimumWidth(self.fixed_width) self.label_content.setMaximumWidth(self.fixed_width) self.label_current.setAlignment(Qt.AlignCenter) self.label_content.setWordWrap(True) self.widgets = [self.label_content, self.label_title, self.label_current, self.combo_title, self.button_close, self.button_run, self.button_next, self.button_previous, self.button_end, self.button_home, self.button_current] arrow = get_image_path('hide.png') self.stylesheet = '''QPushButton { background-color: rgbs(200,200,200,100%); color: rgbs(0,0,0,100%); border-style: outset; border-width: 1px; border-radius: 3px; border-color: rgbs(100,100,100,100%); padding: 2px; } QPushButton:hover { background-color: rgbs(150, 150, 150, 100%); } QPushButton:disabled { background-color: rgbs(230,230,230,100%); color: rgbs(200,200,200,100%); border-color: rgbs(200,200,200,100%); } QComboBox { padding-left: 5px; background-color: rgbs(230,230,230,100%); border-width: 0px; border-radius: 0px; min-height:20px; max-height:20px; } QComboBox::drop-down { subcontrol-origin: padding; subcontrol-position: top left; border-width: 0px; } QComboBox::down-arrow { image: url(''' + arrow + '''); } ''' # Windows fix, slashes should be always in unix-style self.stylesheet = self.stylesheet.replace('\\', '/') for widget in self.widgets: widget.setFocusPolicy(Qt.NoFocus) widget.setStyleSheet(self.stylesheet) layout_top = QHBoxLayout() layout_top.addWidget(self.combo_title) layout_top.addStretch() layout_top.addWidget(self.button_close) layout_top.addSpacerItem(QSpacerItem(self.offset_shadow, self.offset_shadow)) layout_content = QHBoxLayout() layout_content.addWidget(self.label_content) layout_content.addWidget(self.label_image) layout_content.addSpacerItem(QSpacerItem(5, 5)) layout_run = QHBoxLayout() layout_run.addStretch() layout_run.addWidget(self.button_run) layout_run.addStretch() layout_run.addSpacerItem(QSpacerItem(self.offset_shadow, self.offset_shadow)) layout_navigation = QHBoxLayout() layout_navigation.addWidget(self.button_home) layout_navigation.addWidget(self.button_previous) layout_navigation.addStretch() layout_navigation.addWidget(self.label_current) layout_navigation.addStretch() layout_navigation.addWidget(self.button_next) layout_navigation.addWidget(self.button_end) layout_navigation.addSpacerItem(QSpacerItem(self.offset_shadow, self.offset_shadow)) layout = QVBoxLayout() layout.addLayout(layout_top) layout.addStretch() layout.addSpacerItem(QSpacerItem(15, 15)) layout.addLayout(layout_content) layout.addLayout(layout_run) layout.addStretch() layout.addSpacerItem(QSpacerItem(15, 15)) layout.addLayout(layout_navigation) layout.addSpacerItem(QSpacerItem(self.offset_shadow, self.offset_shadow)) layout.setSizeConstraint(QLayout.SetFixedSize) self.setLayout(layout) self.set_funcs_before_fade_in([self._disable_widgets]) self.set_funcs_after_fade_in([self._enable_widgets]) self.set_funcs_before_fade_out([self._disable_widgets]) self.setContextMenuPolicy(Qt.CustomContextMenu)
def setup_page(self): about_label = QLabel( _("The <b>global working directory</b> is " "the working directory for newly opened <i>consoles</i> " "(Python/IPython consoles and terminals), for the " "<i>file explorer</i>, for the <i>find in files</i> " "plugin and for new files created in the <i>editor</i>.")) about_label.setWordWrap(True) startup_group = QGroupBox(_("Startup")) startup_bg = QButtonGroup(startup_group) startup_label = QLabel( _("At startup, the global working " "directory is:")) startup_label.setWordWrap(True) lastdir_radio = self.create_radiobutton( _("the same as in last session"), 'startup/use_last_directory', True, _("At startup, Spyder will restore the " "global directory from last session"), button_group=startup_bg) thisdir_radio = self.create_radiobutton( _("the following directory:"), 'startup/use_fixed_directory', False, _("At startup, the global working " "directory will be the specified path"), button_group=startup_bg) thisdir_bd = self.create_browsedir("", 'startup/fixed_directory', getcwd()) thisdir_radio.toggled.connect(thisdir_bd.setEnabled) lastdir_radio.toggled.connect(thisdir_bd.setDisabled) thisdir_layout = QHBoxLayout() thisdir_layout.addWidget(thisdir_radio) thisdir_layout.addWidget(thisdir_bd) editor_o_group = QGroupBox(_("Open file")) editor_o_label = QLabel(_("Files are opened from:")) editor_o_label.setWordWrap(True) editor_o_bg = QButtonGroup(editor_o_group) editor_o_radio1 = self.create_radiobutton( _("the current file directory"), 'editor/open/browse_scriptdir', button_group=editor_o_bg) editor_o_radio2 = self.create_radiobutton( _("the global working directory"), 'editor/open/browse_workdir', button_group=editor_o_bg) editor_n_group = QGroupBox(_("New file")) editor_n_label = QLabel(_("Files are created in:")) editor_n_label.setWordWrap(True) editor_n_bg = QButtonGroup(editor_n_group) editor_n_radio1 = self.create_radiobutton( _("the current file directory"), 'editor/new/browse_scriptdir', button_group=editor_n_bg) editor_n_radio2 = self.create_radiobutton( _("the global working directory"), 'editor/new/browse_workdir', button_group=editor_n_bg) # Note: default values for the options above are set in plugin's # constructor (see below) other_group = QGroupBox(_("Change to file base directory")) newcb = self.create_checkbox open_box = newcb(_("When opening a file"), 'editor/open/auto_set_to_basedir') save_box = newcb(_("When saving a file"), 'editor/save/auto_set_to_basedir') startup_layout = QVBoxLayout() startup_layout.addWidget(startup_label) startup_layout.addWidget(lastdir_radio) startup_layout.addLayout(thisdir_layout) startup_group.setLayout(startup_layout) editor_o_layout = QVBoxLayout() editor_o_layout.addWidget(editor_o_label) editor_o_layout.addWidget(editor_o_radio1) editor_o_layout.addWidget(editor_o_radio2) editor_o_group.setLayout(editor_o_layout) editor_n_layout = QVBoxLayout() editor_n_layout.addWidget(editor_n_label) editor_n_layout.addWidget(editor_n_radio1) editor_n_layout.addWidget(editor_n_radio2) editor_n_group.setLayout(editor_n_layout) other_layout = QVBoxLayout() other_layout.addWidget(open_box) other_layout.addWidget(save_box) other_group.setLayout(other_layout) vlayout = QVBoxLayout() vlayout.addWidget(about_label) vlayout.addSpacing(10) vlayout.addWidget(startup_group) vlayout.addWidget(editor_o_group) vlayout.addWidget(editor_n_group) vlayout.addWidget(other_group) vlayout.addStretch(1) self.setLayout(vlayout)