Exemplo n.º 1
0
Arquivo: status.py Projeto: Pyke75/ga
    def __init__(self, parent, statusbar):
        QWidget.__init__(self, parent)

        self.label_font = font = get_font('editor')
        font.setPointSize(self.font().pointSize())
        font.setBold(True)
        
        layout = QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)

        statusbar.addPermanentWidget(self)
Exemplo n.º 2
0
 def __init__(self, color, parent=None):
     QHBoxLayout.__init__(self)
     assert isinstance(color, QColor)
     self.lineedit = QLineEdit(color.name(), parent)
     self.connect(self.lineedit, SIGNAL("textChanged(QString)"),
                  self.update_color)
     self.addWidget(self.lineedit)
     self.colorbtn = ColorButton(parent)
     self.colorbtn.color = color
     self.connect(self.colorbtn, SIGNAL("colorChanged(QColor)"),
                  self.update_text)
     self.addWidget(self.colorbtn)
Exemplo n.º 3
0
    def __init__(self, parent, statusbar):
        QWidget.__init__(self, parent)

        self.label_font = font = get_font('editor')
        font.setPointSize(self.font().pointSize())
        font.setBold(True)

        layout = QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)

        statusbar.addPermanentWidget(self)
Exemplo n.º 4
0
 def create_browsefile(self,
                       text,
                       option,
                       default=NoDefault,
                       tip=None,
                       filters=None):
     widget = self.create_lineedit(text,
                                   option,
                                   default,
                                   alignment=Qt.Horizontal)
     for edit in self.lineedits:
         if widget.isAncestorOf(edit):
             break
     msg = _("Invalid file path")
     self.validate_data[edit] = (osp.isfile, msg)
     browse_btn = QPushButton(get_std_icon('FileIcon'), "", self)
     browse_btn.setToolTip(_("Select file"))
     self.connect(browse_btn, SIGNAL("clicked()"),
                  lambda: self.select_file(edit, filters))
     layout = QHBoxLayout()
     layout.addWidget(widget)
     layout.addWidget(browse_btn)
     layout.setContentsMargins(0, 0, 0, 0)
     browsedir = QWidget(self)
     browsedir.setLayout(layout)
     return browsedir
Exemplo n.º 5
0
    def __init__(self, parent, prefix = None, suffix = None, option = None, min_ = None, max_ = None,
                 step = None, tip = None, value = None, changed =None):
        super(MyDoubleSpinBox, self).__init__(parent)
    
        if prefix:
            plabel = QLabel(prefix)
        else:
            plabel = None
        if suffix:
            slabel = QLabel(suffix)
        else:
            slabel = None
        spinbox = QDoubleSpinBox(parent)
        if min_ is not None:
            spinbox.setMinimum(min_)
        if max_ is not None:
            spinbox.setMaximum(max_)
        if step is not None:
            spinbox.setSingleStep(step)
        if tip is not None:
            spinbox.setToolTip(tip)
        layout = QHBoxLayout()
        for subwidget in (plabel, spinbox, slabel):
            if subwidget is not None:
                layout.addWidget(subwidget)
        if value is not None:
            spinbox.setValue(value)
        
        if changed is not None:
            self.connect(spinbox, SIGNAL('valueChanged(double)'), changed)

        layout.addStretch(1)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)
        self.spin = spinbox
Exemplo n.º 6
0
    def create_dateedit(self, prefix, option, default=NoDefault,
                       min_=None, max_=None, step=None, tip=None):
        if prefix:
            plabel = QLabel(prefix)
        else:
            plabel = None

        dateedit = QDateEdit()
        dateedit.setDisplayFormat('dd MMM yyyy')

        def extract_qdate_from_str(x):
            return QDate(int(x[:4]), int(x[5:7]), int(x[8:10]))

        if min_ is not None:
            min_qdate = extract_qdate_from_str(min_)
            dateedit.setMinimumDate(min_qdate)
        if max_ is not None:
            max_qdate = extract_qdate_from_str(max_)
            dateedit.setMaximumDate(max_qdate)
        
        default_qdate = extract_qdate_from_str(default)
    
        dateedit.setDate(default_qdate)        
        if tip is not None:
            dateedit.setToolTip(tip)
        self.dateedits[dateedit] = (option, default)
        layout = QHBoxLayout()
        for subwidget in (plabel, dateedit):
            if subwidget is not None:
                layout.addWidget(subwidget)
        layout.addStretch(1)
        layout.setContentsMargins(0, 0, 0, 0)
        widget = QWidget(self)
        widget.setLayout(layout)
        return widget
Exemplo n.º 7
0
 def create_spinbox(self, prefix, suffix, option, default=NoDefault,
                    min_=None, max_=None, step=None, tip=None):
     if prefix:
         plabel = QLabel(prefix)
     else:
         plabel = None
     if suffix:
         slabel = QLabel(suffix)
     else:
         slabel = None
     spinbox = QSpinBox()
     if min_ is not None:
         spinbox.setMinimum(min_)
     if max_ is not None:
         spinbox.setMaximum(max_)
     if step is not None:
         spinbox.setSingleStep(step)
     if tip is not None:
         spinbox.setToolTip(tip)
     self.spinboxes[spinbox] = (option, default)
     layout = QHBoxLayout()
     for subwidget in (plabel, spinbox, slabel):
         if subwidget is not None:
             layout.addWidget(subwidget)
     layout.addStretch(1)
     layout.setContentsMargins(0, 0, 0, 0)
     widget = QWidget(self)
     widget.setLayout(layout)
     return widget
Exemplo n.º 8
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        
        # Destroying the C++ object right after closing the dialog box,
        # otherwise it may be garbage-collected in another QThread
        # (e.g. the editor's analysis thread in Spyder), thus leading to
        # a segmentation fault on UNIX or an application crash on Windows
        self.setAttribute(Qt.WA_DeleteOnClose)

        self.contents_widget = QListWidget()
        self.contents_widget.setMovement(QListView.Static)
        self.contents_widget.setSpacing(1)

        bbox = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Apply
                                |QDialogButtonBox.Cancel)
        self.apply_btn = bbox.button(QDialogButtonBox.Apply)
        self.connect(bbox, SIGNAL("accepted()"), SLOT("accept()"))
        self.connect(bbox, SIGNAL("rejected()"), SLOT("reject()"))
        self.connect(bbox, SIGNAL("clicked(QAbstractButton*)"),
                     self.button_clicked)

        self.pages_widget = QStackedWidget()
        self.connect(self.pages_widget, SIGNAL("currentChanged(int)"),
                     self.current_page_changed)

        self.connect(self.contents_widget, SIGNAL("currentRowChanged(int)"),
                     self.pages_widget.setCurrentIndex)
        self.contents_widget.setCurrentRow(0)

        hsplitter = QSplitter()
        hsplitter.addWidget(self.contents_widget)
        hsplitter.addWidget(self.pages_widget)

        btnlayout = QHBoxLayout()
        btnlayout.addStretch(1)
        btnlayout.addWidget(bbox)

        vlayout = QVBoxLayout()
        vlayout.addWidget(hsplitter)
        vlayout.addLayout(btnlayout)

        self.setLayout(vlayout)

        self.setWindowTitle(_("Preferences"))
        self.setWindowIcon(get_icon("configure.png"))
Exemplo n.º 9
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
Exemplo n.º 10
0
 def create_coloredit(self, text, option, default=NoDefault, tip=None,
                      without_layout=False):
     label = QLabel(text)
     clayout = ColorLayout(QColor(Qt.black), self)
     clayout.lineedit.setMaximumWidth(80)
     if tip is not None:
         clayout.setToolTip(tip)
     self.coloredits[clayout] = (option, default)
     if without_layout:
         return label, clayout
     layout = QHBoxLayout()
     layout.addWidget(label)
     layout.addLayout(clayout)
     layout.addStretch(1)
     layout.setContentsMargins(0, 0, 0, 0)
     widget = QWidget(self)
     widget.setLayout(layout)
     return widget
Exemplo n.º 11
0
 def create_coloredit(self,
                      text,
                      option,
                      default=NoDefault,
                      tip=None,
                      without_layout=False):
     label = QLabel(text)
     clayout = ColorLayout(QColor(Qt.black), self)
     clayout.lineedit.setMaximumWidth(80)
     if tip is not None:
         clayout.setToolTip(tip)
     self.coloredits[clayout] = (option, default)
     if without_layout:
         return label, clayout
     layout = QHBoxLayout()
     layout.addWidget(label)
     layout.addLayout(clayout)
     layout.addStretch(1)
     layout.setContentsMargins(0, 0, 0, 0)
     widget = QWidget(self)
     widget.setLayout(layout)
     return widget
Exemplo n.º 12
0
 def __init__(self, parent):
     QWidget.__init__(self, parent)
     layout = QHBoxLayout()
     row_nb = 14
     cindex = 0
     for child in dir(QStyle):
         if child.startswith('SP_'):
             if cindex == 0:
                 col_layout = QVBoxLayout()
             icon_layout = QHBoxLayout()
             icon = get_std_icon(child)
             label = QLabel()
             label.setPixmap(icon.pixmap(32, 32))
             icon_layout.addWidget( label )
             icon_layout.addWidget( QLineEdit(child.replace('SP_', '')) )
             col_layout.addLayout(icon_layout)
             cindex = (cindex+1) % row_nb
             if cindex == 0:
                 layout.addLayout(col_layout)                    
     self.setLayout(layout)
     self.setWindowTitle('Standard Platform Icons')
     self.setWindowIcon(get_std_icon('TitleBarMenuButton'))
Exemplo n.º 13
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
Exemplo n.º 14
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)
Exemplo n.º 15
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)
Exemplo n.º 16
0
    def __init__(self, parent, text, choices = None, option = None, tip = None):
        super(MyComboBox, self).__init__(parent)
        """choices: couples (name, key)"""
        label = QLabel(text)
        combobox = QComboBox(parent)
        if tip is not None:
            combobox.setToolTip(tip)
        if choices:
            for name, key in choices:
                combobox.addItem(name, to_qvariant(key))

        layout = QHBoxLayout()
        for subwidget in (label, combobox):
            layout.addWidget(subwidget)
        layout.addStretch(1)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)
        self.box = combobox
Exemplo n.º 17
0
    def create_dateedit(self,
                        prefix,
                        option,
                        default=NoDefault,
                        min_=None,
                        max_=None,
                        step=None,
                        tip=None):
        if prefix:
            plabel = QLabel(prefix)
        else:
            plabel = None

        dateedit = QDateEdit()
        dateedit.setDisplayFormat('dd MMM yyyy')

        def extract_qdate_from_str(x):
            return QDate(int(x[:4]), int(x[5:7]), int(x[8:10]))

        if min_ is not None:
            min_qdate = extract_qdate_from_str(min_)
            dateedit.setMinimumDate(min_qdate)
        if max_ is not None:
            max_qdate = extract_qdate_from_str(max_)
            dateedit.setMaximumDate(max_qdate)

        default_qdate = extract_qdate_from_str(default)

        dateedit.setDate(default_qdate)
        if tip is not None:
            dateedit.setToolTip(tip)
        self.dateedits[dateedit] = (option, default)
        layout = QHBoxLayout()
        for subwidget in (plabel, dateedit):
            if subwidget is not None:
                layout.addWidget(subwidget)
        layout.addStretch(1)
        layout.setContentsMargins(0, 0, 0, 0)
        widget = QWidget(self)
        widget.setLayout(layout)
        return widget
Exemplo n.º 18
0
 def create_lineedit(self,
                     text,
                     option,
                     default=NoDefault,
                     tip=None,
                     alignment=Qt.Vertical):
     label = QLabel(text)
     label.setWordWrap(True)
     edit = QLineEdit()
     layout = QVBoxLayout() if alignment == Qt.Vertical else QHBoxLayout()
     layout.addWidget(label)
     layout.addWidget(edit)
     layout.setContentsMargins(0, 0, 0, 0)
     if tip:
         edit.setToolTip(tip)
     self.lineedits[edit] = (option, default)
     widget = QWidget(self)
     widget.setLayout(layout)
     return widget
Exemplo n.º 19
0
 def create_combobox(self, text, choices, option, default=NoDefault,
                     tip=None):
     """choices: couples (name, key)"""
     label = QLabel(text)
     combobox = QComboBox()
     if tip is not None:
         combobox.setToolTip(tip)
     for name, key in choices:
         combobox.addItem(name, to_qvariant(key))
     self.comboboxes[combobox] = (option, default)
     layout = QHBoxLayout()
     for subwidget in (label, combobox):
         layout.addWidget(subwidget)
     layout.addStretch(1)
     layout.setContentsMargins(0, 0, 0, 0)
     widget = QWidget(self)
     widget.setLayout(layout)
     return widget
Exemplo n.º 20
0
 def create_combobox(self,
                     text,
                     choices,
                     option,
                     default=NoDefault,
                     tip=None):
     """choices: couples (name, key)"""
     label = QLabel(text)
     combobox = QComboBox()
     if tip is not None:
         combobox.setToolTip(tip)
     for name, key in choices:
         combobox.addItem(name, to_qvariant(key))
     self.comboboxes[combobox] = (option, default)
     layout = QHBoxLayout()
     for subwidget in (label, combobox):
         layout.addWidget(subwidget)
     layout.addStretch(1)
     layout.setContentsMargins(0, 0, 0, 0)
     widget = QWidget(self)
     widget.setLayout(layout)
     return widget
Exemplo n.º 21
0
 def create_browsedir(self, text, option, default=NoDefault, tip=None):
     widget = self.create_lineedit(text, option, default,
                                   alignment=Qt.Horizontal)
     for edit in self.lineedits:
         if widget.isAncestorOf(edit):
             break
     msg = _("Invalid directory path")
     self.validate_data[edit] = (osp.isdir, msg)
     browse_btn = QPushButton(get_std_icon('DirOpenIcon'), "", self)
     browse_btn.setToolTip(_("Select directory"))
     self.connect(browse_btn, SIGNAL("clicked()"),
                  lambda: self.select_directory(edit))
     layout = QHBoxLayout()
     layout.addWidget(widget)
     layout.addWidget(browse_btn)
     layout.setContentsMargins(0, 0, 0, 0)
     browsedir = QWidget(self)
     browsedir.setLayout(layout)
     return browsedir
Exemplo n.º 22
0
 def create_spinbox(self,
                    prefix,
                    suffix,
                    option,
                    default=NoDefault,
                    min_=None,
                    max_=None,
                    step=None,
                    tip=None):
     if prefix:
         plabel = QLabel(prefix)
     else:
         plabel = None
     if suffix:
         slabel = QLabel(suffix)
     else:
         slabel = None
     spinbox = QSpinBox()
     if min_ is not None:
         spinbox.setMinimum(min_)
     if max_ is not None:
         spinbox.setMaximum(max_)
     if step is not None:
         spinbox.setSingleStep(step)
     if tip is not None:
         spinbox.setToolTip(tip)
     self.spinboxes[spinbox] = (option, default)
     layout = QHBoxLayout()
     for subwidget in (plabel, spinbox, slabel):
         if subwidget is not None:
             layout.addWidget(subwidget)
     layout.addStretch(1)
     layout.setContentsMargins(0, 0, 0, 0)
     widget = QWidget(self)
     widget.setLayout(layout)
     return widget
Exemplo n.º 23
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)

        # Destroying the C++ object right after closing the dialog box,
        # otherwise it may be garbage-collected in another QThread
        # (e.g. the editor's analysis thread in Spyder), thus leading to
        # a segmentation fault on UNIX or an application crash on Windows
        self.setAttribute(Qt.WA_DeleteOnClose)

        self.contents_widget = QListWidget()
        self.contents_widget.setMovement(QListView.Static)
        self.contents_widget.setSpacing(1)

        bbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Apply
                                | QDialogButtonBox.Cancel)
        self.apply_btn = bbox.button(QDialogButtonBox.Apply)
        self.connect(bbox, SIGNAL("accepted()"), SLOT("accept()"))
        self.connect(bbox, SIGNAL("rejected()"), SLOT("reject()"))
        self.connect(bbox, SIGNAL("clicked(QAbstractButton*)"),
                     self.button_clicked)

        self.pages_widget = QStackedWidget()
        self.connect(self.pages_widget, SIGNAL("currentChanged(int)"),
                     self.current_page_changed)

        self.connect(self.contents_widget, SIGNAL("currentRowChanged(int)"),
                     self.pages_widget.setCurrentIndex)
        self.contents_widget.setCurrentRow(0)

        hsplitter = QSplitter()
        hsplitter.addWidget(self.contents_widget)
        hsplitter.addWidget(self.pages_widget)

        btnlayout = QHBoxLayout()
        btnlayout.addStretch(1)
        btnlayout.addWidget(bbox)

        vlayout = QVBoxLayout()
        vlayout.addWidget(hsplitter)
        vlayout.addLayout(btnlayout)

        self.setLayout(vlayout)

        self.setWindowTitle(_("Preferences"))
        self.setWindowIcon(get_icon("configure.png"))
Exemplo n.º 24
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)
Exemplo n.º 25
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)
Exemplo n.º 26
0
 def create_scedit(self, text, option, default=NoDefault, tip=None,
                   without_layout=False):
     label = QLabel(text)
     clayout = ColorLayout(QColor(Qt.black), self)
     clayout.lineedit.setMaximumWidth(80)
     if tip is not None:
         clayout.setToolTip(tip)
     cb_bold = QCheckBox()
     cb_bold.setIcon(get_icon("bold.png"))
     cb_bold.setToolTip(_("Bold"))
     cb_italic = QCheckBox()
     cb_italic.setIcon(get_icon("italic.png"))
     cb_italic.setToolTip(_("Italic"))
     self.scedits[(clayout, cb_bold, cb_italic)] = (option, default)
     if without_layout:
         return label, clayout, cb_bold, cb_italic
     layout = QHBoxLayout()
     layout.addWidget(label)
     layout.addLayout(clayout)
     layout.addSpacing(10)
     layout.addWidget(cb_bold)
     layout.addWidget(cb_italic)
     layout.addStretch(1)
     layout.setContentsMargins(0, 0, 0, 0)
     widget = QWidget(self)
     widget.setLayout(layout)
     return widget
Exemplo n.º 27
0
 def create_scedit(self,
                   text,
                   option,
                   default=NoDefault,
                   tip=None,
                   without_layout=False):
     label = QLabel(text)
     clayout = ColorLayout(QColor(Qt.black), self)
     clayout.lineedit.setMaximumWidth(80)
     if tip is not None:
         clayout.setToolTip(tip)
     cb_bold = QCheckBox()
     cb_bold.setIcon(get_icon("bold.png"))
     cb_bold.setToolTip(_("Bold"))
     cb_italic = QCheckBox()
     cb_italic.setIcon(get_icon("italic.png"))
     cb_italic.setToolTip(_("Italic"))
     self.scedits[(clayout, cb_bold, cb_italic)] = (option, default)
     if without_layout:
         return label, clayout, cb_bold, cb_italic
     layout = QHBoxLayout()
     layout.addWidget(label)
     layout.addLayout(clayout)
     layout.addSpacing(10)
     layout.addWidget(cb_bold)
     layout.addWidget(cb_italic)
     layout.addStretch(1)
     layout.setContentsMargins(0, 0, 0, 0)
     widget = QWidget(self)
     widget.setLayout(layout)
     return widget