Esempio n. 1
0
 def create_button(self, text, callback):
     btn = QPushButton(text)
     self.connect(btn, SIGNAL('clicked()'), callback)
     self.connect(btn,
                  SIGNAL('clicked()'),
                  lambda opt='': self.has_been_modified(opt))
     return btn
Esempio n. 2
0
def create_action(parent, text, shortcut=None, icon=None, tip=None,
                  toggled=None, triggered=None, data=None, menurole=None,
                  context=Qt.WindowShortcut):
    """Create a QAction"""
    action = QAction(text, parent)
    if triggered is not None:
        parent.connect(action, SIGNAL("triggered()"), triggered)
    if toggled is not None:
        parent.connect(action, SIGNAL("toggled(bool)"), toggled)
        action.setCheckable(True)
    if icon is not None:
        if isinstance(icon, (str, unicode)):
            icon = get_icon(icon)
        action.setIcon(icon)
    if shortcut is not None:
        action.setShortcut(shortcut)
    if tip is not None:
        action.setToolTip(tip)
        action.setStatusTip(tip)
    if data is not None:
        action.setData(to_qvariant(data))
    if menurole is not None:
        action.setMenuRole(menurole)
    #TODO: Hard-code all shortcuts and choose context=Qt.WidgetShortcut
    # (this will avoid calling shortcuts from another dockwidget
    #  since the context thing doesn't work quite well with these widgets)
    action.setShortcutContext(context)
    return action
Esempio n. 3
0
 def setup_page(self):
     self.table = ShortcutsTable(self)
     self.connect(self.table.model,
                  SIGNAL("dataChanged(QModelIndex,QModelIndex)"),
                  lambda i1, i2, opt='': self.has_been_modified(opt))
     vlayout = QVBoxLayout()
     vlayout.addWidget(self.table)
     reset_btn = QPushButton(_("Reset to default values"))
     self.connect(reset_btn, SIGNAL('clicked()'), self.reset_to_default)
     vlayout.addWidget(reset_btn)
     self.setLayout(vlayout)
Esempio n. 4
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)
Esempio n. 5
0
 def initialize_plugin(self):
     """
     Initialize plugin: connect signals, setup actions, ...
     """
     self.plugin_actions = self.get_plugin_actions()
     QObject.connect(self, SIGNAL('show_message(QString,int)'),
                     self.show_message)
     QObject.connect(self, SIGNAL('update_plugin_title()'),
                     self.__update_plugin_title)
     if self.sig_option_changed is not None:
         self.sig_option_changed.connect(self.set_option)
     self.setWindowTitle(self.get_plugin_title())
Esempio n. 6
0
 def show(self, dialog):
     """Generic method to show a non-modal dialog and keep reference
     to the Qt C++ object"""
     for dlg in self.dialogs.values():
         if unicode(dlg.windowTitle()) == unicode(dialog.windowTitle()):
             dlg.show()
             dlg.raise_()
             break
     else:
         dialog.show()
         self.dialogs[id(dialog)] = dialog
         self.connect(dialog, SIGNAL('accepted()'),
                      lambda eid=id(dialog): self.dialog_finished(eid))
         self.connect(dialog, SIGNAL('rejected()'),
                      lambda eid=id(dialog): self.dialog_finished(eid))
Esempio n. 7
0
    def create_radiobutton(self,
                           text,
                           option,
                           default=NoDefault,
                           tip=None,
                           msg_warning=None,
                           msg_info=None,
                           msg_if_enabled=False,
                           button_group=None):
        radiobutton = QRadioButton(text)
        if button_group is None:
            if self.default_button_group is None:
                self.default_button_group = QButtonGroup(self)
            button_group = self.default_button_group
        button_group.addButton(radiobutton)
        if tip is not None:
            radiobutton.setToolTip(tip)
        self.radiobuttons[radiobutton] = (option, default)
        if msg_warning is not None or msg_info is not None:

            def show_message(is_checked):
                if is_checked or not msg_if_enabled:
                    if msg_warning is not None:
                        QMessageBox.warning(self, self.get_name(), msg_warning,
                                            QMessageBox.Ok)
                    if msg_info is not None:
                        QMessageBox.information(self, self.get_name(),
                                                msg_info, QMessageBox.Ok)

            self.connect(radiobutton, SIGNAL("toggled(bool)"), show_message)
        return radiobutton
Esempio n. 8
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
Esempio n. 9
0
    def create_dockwidget(self):
        """
        Add to parent QMainWindow as a dock widget
        """

        # This is not clear yet why the following do not work...
        # (see Issue #880)
##         # Using Qt.Window window flags solves Issue #880 (detached dockwidgets
##         # are not painted after restarting Spyder and restoring their hexstate)
##         # but it does not work with PyQt <=v4.7 (dockwidgets can't be docked)
##         # or non-Windows platforms (lot of warnings are printed out)
##         # (so in those cases, we use the default window flags: Qt.Widget):
##         flags = Qt.Widget if is_old_pyqt or os.name != 'nt' else Qt.Window
        dock = QDockWidget(self.get_plugin_title(), self.main)#, flags)

        dock.setObjectName(self.__class__.__name__+"_dw")
        dock.setAllowedAreas(self.ALLOWED_AREAS)
        dock.setFeatures(self.FEATURES)
        dock.setWidget(self)
        self.update_margins()
        self.connect(dock, SIGNAL('visibilityChanged(bool)'),
                     self.visibility_changed)
        self.dockwidget = dock
        short = self.get_option("shortcut", None)
        if short is not None:
            shortcut = QShortcut(QKeySequence(short),
                                 self.main, self.switch_to_plugin)
            self.register_shortcut(shortcut, "_",
                                   "Switch to %s" % self.CONF_SECTION,
                                   default=short)
        return (dock, self.LOCATION)
Esempio n. 10
0
 def set_color(self, color):
     if color != self._color:
         self._color = color
         self.emit(SIGNAL("colorChanged(QColor)"), self._color)
         pixmap = QPixmap(self.iconSize())
         pixmap.fill(color)
         self.setIcon(QIcon(pixmap))
Esempio n. 11
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
Esempio n. 12
0
    def create_checkbox(self,
                        text,
                        option,
                        default=NoDefault,
                        tip=None,
                        msg_warning=None,
                        msg_info=None,
                        msg_if_enabled=False):
        checkbox = QCheckBox(text)
        if tip is not None:
            checkbox.setToolTip(tip)
        self.checkboxes[checkbox] = (option, default)
        if msg_warning is not None or msg_info is not None:

            def show_message(is_checked):
                if is_checked or not msg_if_enabled:
                    if msg_warning is not None:
                        QMessageBox.warning(self, self.get_name(), msg_warning,
                                            QMessageBox.Ok)
                    if msg_info is not None:
                        QMessageBox.information(self, self.get_name(),
                                                msg_info, QMessageBox.Ok)

            self.connect(checkbox, SIGNAL("clicked(bool)"), show_message)
        return checkbox
Esempio n. 13
0
 def add_page(self, widget):
     self.connect(self, SIGNAL('check_settings()'), widget.check_settings)
     self.connect(widget,
                  SIGNAL('show_this_page()'),
                  lambda row=self.contents_widget.count(): self.
                  contents_widget.setCurrentRow(row))
     self.connect(widget, SIGNAL("apply_button_enabled(bool)"),
                  self.apply_btn.setEnabled)
     scrollarea = QScrollArea(self)
     scrollarea.setWidgetResizable(True)
     scrollarea.setWidget(widget)
     self.pages_widget.addWidget(scrollarea)
     item = QListWidgetItem(self.contents_widget)
     item.setIcon(widget.get_icon())
     item.setText(widget.get_name())
     item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
     item.setSizeHint(QSize(0, 25))
Esempio n. 14
0
File: base.py Progetto: jsantoul/ga
    def append_text_to_shell(self, text, error, prompt):
        """
        Append text to Python shell
        In a way, this method overrides the method 'insert_text' when text is 
        inserted at the end of the text widget for a Python shell
        
        Handles error messages and show blue underlined links
        Handles ANSI color sequences
        Handles ANSI FF sequence
        """
        cursor = self.textCursor()
        cursor.movePosition(QTextCursor.End)
        while True:
            index = text.find(chr(12))
            if index == -1:
                break
            text = text[index + 1:]
            self.clear()
        if error:
            is_traceback = False
            for text in text.splitlines(True):
                if text.startswith('  File') \
                and not text.startswith('  File "<'):
                    is_traceback = True
                    # Show error links in blue underlined text
                    cursor.insertText('  ', self.default_style.format)
                    cursor.insertText(text[2:],
                                      self.traceback_link_style.format)
                else:
                    # Show error/warning messages in red
                    cursor.insertText(text, self.error_style.format)
            if is_traceback:
                self.emit(SIGNAL('traceback_available()'))
        elif prompt:
            # Show prompt in green
            cursor.insertText(text, self.prompt_style.format)
        else:
            # Show other outputs in black
            last_end = 0
            for match in self.COLOR_PATTERN.finditer(text):
                cursor.insertText(text[last_end:match.start()],
                                  self.default_style.format)
                last_end = match.end()
                for code in [int(_c) for _c in match.group(1).split(';')]:
                    self.ansi_handler.set_code(code)
                self.default_style.format = self.ansi_handler.get_format()
            cursor.insertText(text[last_end:], self.default_style.format)
#            # Slower alternative:
#            segments = self.COLOR_PATTERN.split(text)
#            cursor.insertText(segments.pop(0), self.default_style.format)
#            if segments:
#                for ansi_tags, text in zip(segments[::2], segments[1::2]):
#                    for ansi_tag in ansi_tags.split(';'):
#                        self.ansi_handler.set_code(int(ansi_tag))
#                    self.default_style.format = self.ansi_handler.get_format()
#                    cursor.insertText(text, self.default_style.format)
        self.set_cursor_position('eof')
        self.setCurrentCharFormat(self.default_style.format)
Esempio n. 15
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"))
Esempio n. 16
0
 def set_grth(self):
     '''
     Sets growth rate parameter
     '''
     widget = self.grth_spin.spin
     if isinstance(widget, QDoubleSpinBox):
         data = widget.value()
         self.grth = float(data)
         self.emit(SIGNAL('rates_changed()'))
Esempio n. 17
0
 def set_population_prolong(self):
     '''
     Sets population prolongation method
     '''
     widget = self.population_prolong_combo.box
     if isinstance(widget, QComboBox):
         data = widget.itemData(widget.currentIndex())
         self.population_prolong = unicode(data.toString())
         self.emit(SIGNAL('population_changed()'))
Esempio n. 18
0
 def set_dsct(self):
     '''
     Sets discount rate parameter
     '''
     widget = self.dsct_spin.spin
     if isinstance(widget, QDoubleSpinBox):
         data = widget.value()
         self.dsct = float(data)
         self.emit(SIGNAL('rates_changed()'))
Esempio n. 19
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)
Esempio n. 20
0
 def set_population(self):
     '''
     Sets population data
     '''
     widget = self.population_combo.box
     if isinstance(widget, QComboBox):
         data = widget.itemData(widget.currentIndex())
         data_name = unicode(data.toString())
         self.population_name = data_name
         self.emit(SIGNAL('population_changed()'))
Esempio n. 21
0
 def set_state_proj_params(self):
     '''
     Sets state projection parameters
     '''
     widget = self.state_proj_combo.box
     if isinstance(widget, QComboBox):
         data = widget.itemData(widget.currentIndex())
         data_name = unicode(data.toString())
         self.state_proj = data_name
         self.emit(SIGNAL('state_proj_changed()'))
Esempio n. 22
0
 def set_taxes_proj(self):
     '''
     Sets taxes projection
     '''
     widget = self.taxes_proj_combo.box
     if isinstance(widget, QComboBox):
         data = widget.itemData(widget.currentIndex())
         data_name = unicode(data.toString())
         self.taxes_proj = data_name
         self.emit(SIGNAL('taxes_proj_changed()'))
Esempio n. 23
0
File: base.py Progetto: jsantoul/ga
    def __init__(self, parent=None):
        TextEditBaseWidget.__init__(self, parent)

        self.light_background = True

        self.setMaximumBlockCount(300)

        # ANSI escape code handler
        self.ansi_handler = QtANSIEscapeCodeHandler()

        # Disable undo/redo (nonsense for a console widget...):
        self.setUndoRedoEnabled(False)

        self.connect(
            self, SIGNAL('userListActivated(int, const QString)'),
            lambda user_id, text: self.emit(
                SIGNAL('completion_widget_activated(QString)'), text))

        self.default_style = ConsoleFontStyle(foregroundcolor=0x000000,
                                              backgroundcolor=0xFFFFFF,
                                              bold=False,
                                              italic=False,
                                              underline=False)
        self.error_style = ConsoleFontStyle(foregroundcolor=0xFF0000,
                                            backgroundcolor=0xFFFFFF,
                                            bold=False,
                                            italic=False,
                                            underline=False)
        self.traceback_link_style = ConsoleFontStyle(foregroundcolor=0x0000FF,
                                                     backgroundcolor=0xFFFFFF,
                                                     bold=True,
                                                     italic=False,
                                                     underline=True)
        self.prompt_style = ConsoleFontStyle(foregroundcolor=0x00AA00,
                                             backgroundcolor=0xFFFFFF,
                                             bold=True,
                                             italic=False,
                                             underline=False)
        self.font_styles = (self.default_style, self.error_style,
                            self.traceback_link_style, self.prompt_style)
        self.set_pythonshell_font()
        self.setMouseTracking(True)
Esempio n. 24
0
File: base.py Progetto: jsantoul/ga
 def __init__(self, parent, ancestor):
     QListWidget.__init__(self, ancestor)
     self.setWindowFlags(Qt.SubWindow | Qt.FramelessWindowHint)
     self.textedit = parent
     self.completion_list = None
     self.case_sensitive = False
     self.show_single = None
     self.enter_select = None
     self.hide()
     self.connect(self, SIGNAL("itemActivated(QListWidgetItem*)"),
                  self.item_selected)
Esempio n. 25
0
File: base.py Progetto: jsantoul/ga
    def __init__(self, parent=None):
        QPlainTextEdit.__init__(self, parent)
        mixins.BaseEditMixin.__init__(self)
        self.setAttribute(Qt.WA_DeleteOnClose)

        self.extra_selections_dict = {}

        self.connect(self, SIGNAL('textChanged()'), self.changed)
        self.connect(self, SIGNAL('cursorPositionChanged()'),
                     self.cursor_position_changed)

        self.indent_chars = " " * 4

        # Code completion / calltips
        if parent is not None:
            mainwin = parent
            while not isinstance(mainwin, QMainWindow):
                mainwin = mainwin.parent()
                if mainwin is None:
                    break
            if mainwin is not None:
                parent = mainwin
        self.completion_widget = CompletionWidget(self, parent)
        self.codecompletion_auto = False
        self.codecompletion_case = True
        self.codecompletion_single = False
        self.codecompletion_enter = False
        self.calltips = True
        self.calltip_position = None
        self.calltip_size = 600
        self.calltip_font = QFont()
        self.completion_text = ""

        # Brace matching
        self.bracepos = None
        self.matched_p_color = QColor(Qt.green)
        self.unmatched_p_color = QColor(Qt.red)
Esempio n. 26
0
def create_toolbutton(parent, text=None, shortcut=None, icon=None, tip=None,
                      toggled=None, triggered=None,
                      autoraise=True, text_beside_icon=False):
    """Create a QToolButton"""
    button = QToolButton(parent)
    if text is not None:
        button.setText(text)
    if icon is not None:
        if isinstance(icon, (str, unicode)):
            icon = get_icon(icon)
        button.setIcon(icon)
    if text is not None or tip is not None:
        button.setToolTip(text if tip is None else tip)
    if text_beside_icon:
        button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
    button.setAutoRaise(autoraise)
    if triggered is not None:
        QObject.connect(button, SIGNAL('clicked()'), triggered)
    if toggled is not None:
        QObject.connect(button, SIGNAL("toggled(bool)"), toggled)
        button.setCheckable(True)
    if shortcut is not None:
        button.setShortcut(shortcut)
    return button
Esempio n. 27
0
 def __init__(self, parent, statusbar):
     StatusBarWidget.__init__(self, parent, statusbar)
     self.setToolTip(self.TIP)
     layout = self.layout()
     layout.addWidget(QLabel(self.TITLE))
     self.label = QLabel()
     self.label.setFont(self.label_font)
     layout.addWidget(self.label)
     layout.addSpacing(20)
     if self.is_supported():
         self.timer = QTimer()
         self.connect(self.timer, SIGNAL('timeout()'), self.update_label)
         self.timer.start(2000)
     else:
         self.timer = None
         self.hide()
Esempio n. 28
0
 def setData(self, index, value, role=Qt.EditRole):
     if index.isValid() and 0 <= index.row() < len(self.shortcuts):
         shortcut = self.shortcuts[index.row()]
         key = shortcut.key
         column = index.column()
         text = from_qvariant(value, str)
         if column == MOD1:
             key.modifiers[0] = Key.modifier_from_name(text)
         elif column == MOD2:
             key.modifiers[1] = Key.modifier_from_name(text)
         elif column == MOD3:
             key.modifiers[2] = Key.modifier_from_name(text)
         elif column == KEY:
             key.key = Key.key_from_str(text)
         self.emit(SIGNAL("dataChanged(QModelIndex,QModelIndex)"), index,
                   index)
         return True
     return False
Esempio n. 29
0
 def check_shortcuts(self):
     """Check shortcuts for conflicts"""
     conflicts = []
     for index, sh1 in enumerate(self.model.shortcuts):
         if index == len(self.model.shortcuts) - 1:
             break
         for sh2 in self.model.shortcuts[index + 1:]:
             if sh2 is sh1:
                 continue
             if str(sh2.key) == str(sh1.key) \
                and (sh1.context == sh2.context or sh1.context == '_'
                     or sh2.context == '_'):
                 conflicts.append((sh1, sh2))
     if conflicts:
         self.parent().emit(SIGNAL('show_this_page()'))
         cstr = "\n".join(
             ['%s <---> %s' % (sh1, sh2) for sh1, sh2 in conflicts])
         QMessageBox.warning(
             self, _("Conflicts"),
             _("The following conflicts have been "
               "detected:") + "\n" + cstr, QMessageBox.Ok)
Esempio n. 30
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)