示例#1
0
    def setup_page(self):
        tabs = QTabWidget()
        names = self.get_option("names")
        names.pop(names.index(CUSTOM_COLOR_SCHEME_NAME))
        names.insert(0, CUSTOM_COLOR_SCHEME_NAME)
        fieldnames = {
            "background": _("Background:"),
            "currentline": _("Current line:"),
            "occurence": _("Occurence:"),
            "ctrlclick": _("Link:"),
            "sideareas": _("Side areas:"),
            "matched_p": _("Matched parentheses:"),
            "unmatched_p": _("Unmatched parentheses:"),
            "normal": _("Normal text:"),
            "keyword": _("Keyword:"),
            "builtin": _("Builtin:"),
            "definition": _("Definition:"),
            "comment": _("Comment:"),
            "string": _("String:"),
            "number": _("Number:"),
            "instance": _("Instance:"),
        }
        from src.gui.spyder_widgets.sourcecode import syntaxhighlighters
        assert all([
            key in fieldnames for key in syntaxhighlighters.COLOR_SCHEME_KEYS
        ])
        for tabname in names:
            cs_group = QGroupBox(_("Color scheme"))
            cs_layout = QGridLayout()
            for row, key in enumerate(syntaxhighlighters.COLOR_SCHEME_KEYS):
                option = "%s/%s" % (tabname, key)
                value = self.get_option(option)
                name = fieldnames[key]
                if isinstance(value, basestring):
                    label, clayout = self.create_coloredit(name,
                                                           option,
                                                           without_layout=True)
                    label.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
                    cs_layout.addWidget(label, row + 1, 0)
                    cs_layout.addLayout(clayout, row + 1, 1)
                else:
                    label, clayout, cb_bold, cb_italic = self.create_scedit(
                        name, option, without_layout=True)
                    label.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
                    cs_layout.addWidget(label, row + 1, 0)
                    cs_layout.addLayout(clayout, row + 1, 1)
                    cs_layout.addWidget(cb_bold, row + 1, 2)
                    cs_layout.addWidget(cb_italic, row + 1, 3)
            cs_group.setLayout(cs_layout)
            if tabname in COLOR_SCHEME_NAMES:
                def_btn = self.create_button(
                    _("Reset to default values"),
                    lambda: self.reset_to_default(tabname))
                tabs.addTab(self.create_tab(cs_group, def_btn), tabname)
            else:
                tabs.addTab(self.create_tab(cs_group), tabname)

        vlayout = QVBoxLayout()
        vlayout.addWidget(tabs)
        self.setLayout(vlayout)
示例#2
0
 def setup_page(self):
     tabs = QTabWidget()
     names = self.get_option("names")
     names.pop(names.index(CUSTOM_COLOR_SCHEME_NAME))
     names.insert(0, CUSTOM_COLOR_SCHEME_NAME)
     fieldnames = {
                   "background":     _("Background:"),
                   "currentline":    _("Current line:"),
                   "occurence":      _("Occurence:"),
                   "ctrlclick":      _("Link:"),
                   "sideareas":      _("Side areas:"),
                   "matched_p":      _("Matched parentheses:"),
                   "unmatched_p":    _("Unmatched parentheses:"),
                   "normal":         _("Normal text:"),
                   "keyword":        _("Keyword:"),
                   "builtin":        _("Builtin:"),
                   "definition":     _("Definition:"),
                   "comment":        _("Comment:"),
                   "string":         _("String:"),
                   "number":         _("Number:"),
                   "instance":       _("Instance:"),
                   }
     from src.gui.spyder_widgets.sourcecode import syntaxhighlighters
     assert all([key in fieldnames
                 for key in syntaxhighlighters.COLOR_SCHEME_KEYS])
     for tabname in names:
         cs_group = QGroupBox(_("Color scheme"))
         cs_layout = QGridLayout()
         for row, key in enumerate(syntaxhighlighters.COLOR_SCHEME_KEYS):
             option = "%s/%s" % (tabname, key)
             value = self.get_option(option)
             name = fieldnames[key]
             if isinstance(value, basestring):
                 label, clayout = self.create_coloredit(name, option,
                                                        without_layout=True)
                 label.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
                 cs_layout.addWidget(label, row+1, 0)
                 cs_layout.addLayout(clayout, row+1, 1)
             else:
                 label, clayout, cb_bold, cb_italic = self.create_scedit(
                                         name, option, without_layout=True)
                 label.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
                 cs_layout.addWidget(label, row+1, 0)
                 cs_layout.addLayout(clayout, row+1, 1)
                 cs_layout.addWidget(cb_bold, row+1, 2)
                 cs_layout.addWidget(cb_italic, row+1, 3)
         cs_group.setLayout(cs_layout)
         if tabname in COLOR_SCHEME_NAMES:
             def_btn = self.create_button(_("Reset to default values"),
                                      lambda: self.reset_to_default(tabname))
             tabs.addTab(self.create_tab(cs_group, def_btn), tabname)
         else:
             tabs.addTab(self.create_tab(cs_group), tabname)
     
     vlayout = QVBoxLayout()
     vlayout.addWidget(tabs)
     self.setLayout(vlayout)
示例#3
0
    def setup_page(self):
        """
        Setup the page of the survey widget
        """

        population_group = QGroupBox(_("Alternatives population data"))
        population_bg = QButtonGroup(self)
        population_label = QLabel(_("Location of population data"))

        country_default_radio = self.create_radiobutton(
            _("Use country default population data"),
            'use_default',
            False,
            tip=_("Use country default population data"),
            button_group=population_bg)
        population_radio = self.create_radiobutton(
            _("The following file"),  # le fichier suivant",
            'enable',
            True,
            _("population data file for micrsosimulation"
              ),  # "Fichier de données pour la microsimulation",
            button_group=population_bg)
        population_file = self.create_browsefile("",
                                                 'data_file',
                                                 filters='*.h5')

        self.connect(country_default_radio, SIGNAL("toggled(bool)"),
                     population_file.setDisabled)
        self.connect(population_radio, SIGNAL("toggled(bool)"),
                     population_file.setEnabled)
        population_file_layout = QHBoxLayout()
        population_file_layout.addWidget(population_radio)
        population_file_layout.addWidget(population_file)

        population_layout = QVBoxLayout()
        population_layout.addWidget(population_label)
        population_layout.addWidget(country_default_radio)
        population_layout.addLayout(population_file_layout)
        population_group.setLayout(population_layout)
        vlayout = QVBoxLayout()
        vlayout.addWidget(population_group)
        vlayout.addStretch(1)
        self.setLayout(vlayout)
示例#4
0
 def create_fontgroup(self,
                      option=None,
                      text=None,
                      tip=None,
                      fontfilters=None):
     """Option=None -> setting plugin font"""
     fontlabel = QLabel(_("Font: "))
     fontbox = QFontComboBox()
     if fontfilters is not None:
         fontbox.setFontFilters(fontfilters)
     sizelabel = QLabel("  " + _("Size: "))
     sizebox = QSpinBox()
     sizebox.setRange(7, 100)
     self.fontboxes[(fontbox, sizebox)] = option
     layout = QHBoxLayout()
     for subwidget in (fontlabel, fontbox, sizelabel, sizebox):
         layout.addWidget(subwidget)
     layout.addStretch(1)
     if text is None:
         text = _("Font style")
     group = QGroupBox(text)
     group.setLayout(layout)
     if tip is not None:
         group.setToolTip(tip)
     return group
示例#5
0
    def setup_page(self):
        """
        Setup the page of the survey widget
        """
        
        profiles_group = QGroupBox(_("Alternatives profiles data")) 
        profiles_bg = QButtonGroup(self)
        profiles_label = QLabel(_("Location of profiles data")) 

        country_default_radio = self.create_radiobutton(_("Use country default profiles data"),
                                                    'use_default', False,
                                                    tip = _("Use country default profiles data"),
                                                    
                                button_group = profiles_bg)
        profiles_radio = self.create_radiobutton(_("The following file"),  # le fichier suivant",
                                               'enable', True,
                                               _("profiles data file for micrsosimulation"), # "Fichier de données pour la microsimulation",
                                               button_group=profiles_bg)
        profiles_file = self.create_browsefile("", 'data_file',
                                             filters='*.h5')
        
        self.connect(country_default_radio, SIGNAL("toggled(bool)"),
                     profiles_file.setDisabled)
        self.connect(profiles_radio, SIGNAL("toggled(bool)"),
                     profiles_file.setEnabled)
        profiles_file_layout = QHBoxLayout()
        profiles_file_layout.addWidget(profiles_radio)
        profiles_file_layout.addWidget(profiles_file)

        profiles_layout = QVBoxLayout()
        profiles_layout.addWidget(profiles_label)
        profiles_layout.addWidget(country_default_radio)
        profiles_layout.addLayout(profiles_file_layout)
        profiles_group.setLayout(profiles_layout)

        vlayout = QVBoxLayout()
        vlayout.addWidget(profiles_group)
        vlayout.addStretch(1)
        self.setLayout(vlayout)
示例#6
0
 def create_fontgroup(self, option=None, text=None,
                      tip=None, fontfilters=None):
     """Option=None -> setting plugin font"""
     fontlabel = QLabel(_("Font: "))
     fontbox = QFontComboBox()
     if fontfilters is not None:
         fontbox.setFontFilters(fontfilters)
     sizelabel = QLabel("  "+_("Size: "))
     sizebox = QSpinBox()
     sizebox.setRange(7, 100)
     self.fontboxes[(fontbox, sizebox)] = option
     layout = QHBoxLayout()
     for subwidget in (fontlabel, fontbox, sizelabel, sizebox):
         layout.addWidget(subwidget)
     layout.addStretch(1)
     if text is None:
         text = _("Font style")
     group = QGroupBox(text)
     group.setLayout(layout)
     if tip is not None:
         group.setToolTip(tip)
     return group
示例#7
0
 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)
示例#8
0
    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)