コード例 #1
0
 def testCtorWithCreatedEnums(self):
     '''A simple case of QPen creation using created enums.'''
     width = 0
     style = Qt.PenStyle(0)
     cap = Qt.PenCapStyle(0)
     join = Qt.PenJoinStyle(0)
     pen = QPen(Qt.blue, width, style, cap, join)
コード例 #2
0
    def __init__(self, parent=None):
        super(InterfaceDialog, self).__init__(parent)

        Ui_Class, _ = loadUiType('ui/interfacedialog.ui')
        self.ui = Ui_Class()
        self.ui.setupUi(self)

        self.ui.comboBox_interface.addItems(
            sorted(can.interfaces.interface.VALID_INTERFACES))
        self.set_bitrates(canopen_bitrates)
        self.selection = {}

        cfg = can.util.load_config()
        if cfg['interface']:
            index = self.ui.comboBox_interface.findText(
                cfg['interface'], flags=Qt.MatchFlag(Qt.MatchFixedString))
            if index >= 0:
                self.ui.comboBox_interface.setCurrentIndex(index)
                if cfg['channel']:
                    index = self.ui.comboBox_channel.findText(
                        cfg['channel'],
                        flags=Qt.MatchFlag(Qt.MatchFixedString))
                    if index >= 0:
                        self.ui.comboBox_channel.setCurrentIndex(index)
                    else:
                        self.ui.comboBox_channel.setCurrentText(cfg['channel'])
コード例 #3
0
    def flags(self, index):
        """ Define editable cells

        :param index:
        """
        if not index.isValid():
            return Qt.ItemIsEnabled

        if index.column() in [NODE_NAME, NODE_FILE]:
            return Qt.ItemFlags(
                QAbstractTableModel.flags(self, index) | Qt.ItemIsEditable)

        return Qt.ItemFlags(QAbstractTableModel.flags(self, index))
コード例 #4
0
    def loadFlags(self, metaprpty):

        itemFlags = Qt.ItemFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)

        editableState = metaprpty.getParam("uiEditable", Eds.Disabled)
        if editableState:
            # #Allow edition of the column
            itemFlags = Qt.ItemFlags(Qt.ItemIsEditable | itemFlags)

            if editableState == Eds.Multi:
                itemFlags = Qt.ItemFlags(ItemUserFlag.MultiEditable
                                         | itemFlags)

        self.setFlags(itemFlags)
コード例 #5
0
    def _flagsFromProperty(self, metaprpty):

        itemFlags = Qt.ItemFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)

        editMode = metaprpty.getParam("uiEditable", Eds.Disabled)
        if editMode or ALL_EDITABLE:
            # #Allow edition of the column
            itemFlags = Qt.ItemFlags(Qt.ItemIsEditable | itemFlags)

            if editMode == Eds.Multi:
                itemFlags = Qt.ItemFlags(ItemUserFlag.MultiEditable
                                         | itemFlags)

        return itemFlags
コード例 #6
0
    def flags(self, index):
        if not index.isValid():
            return Qt.ItemIsEnabled
        try:
            node = self.nodeFromIndex(index)
            if node.Type is not sbml_entities.TYPE.NONE:
                return Qt.ItemFlags(
                    QAbstractItemModel.flags(self, index)
                    | Qt.ItemIsEditable)  # editable item
        except:
            pass

        return Qt.ItemFlags(QAbstractItemModel.flags(
            self, index))  # non-editable item
コード例 #7
0
    def buttonsOrientationChanged(self, index):
        self.mainLayout.setSizeConstraint(QLayout.SetNoConstraint);
        self.setMinimumSize(0, 0);

        orientation = Qt.Orientation(int(self.buttonsOrientationComboBox.itemData(index)))

        if orientation == self.buttonBox.orientation():
            return

        self.mainLayout.removeWidget(self.buttonBox);

        spacing = self.mainLayout.spacing()

        oldSizeHint = self.buttonBox.sizeHint() + QSize(spacing, spacing);
        self.buttonBox.setOrientation(orientation)
        newSizeHint = self.buttonBox.sizeHint() + QSize(spacing, spacing)

        if orientation == Qt.Horizontal:
            self.mainLayout.addWidget(self.buttonBox, 2, 0);
            self.resize(self.size() + QSize(-oldSizeHint.width(), newSizeHint.height()))
        else:
            self.mainLayout.addWidget(self.buttonBox, 0, 3, 2, 1);
            self.resize(self.size() + QSize(newSizeHint.width(), -oldSizeHint.height()))

        self.mainLayout.setSizeConstraint(QLayout.SetDefaultConstraint)
コード例 #8
0
    def on_openChrootButton_clicked(self):
        projectName = self.currentProject
        if projectName is None or not self.manager.isChRootInit(projectName):
            return

        currentPackage = self.__packageManager.currentPackage()
        runnable = ProgressRunnable2()
        useRootId = self.mainWindow.checkUserRootForChroot.isChecked()
        if useRootId:
            self.mainWindow.checkUserRootForChroot.setCheckState(
                Qt.CheckState(False))
        if currentPackage is None:
            runnable.setRunMethod(self.manager.goToChRoot,
                                  projectName,
                                  useRootId=useRootId,
                                  detach=True)
        else:
            runnable.setRunMethod(self.manager.goToChRoot,
                                  projectName,
                                  currentPackage,
                                  useRootId=useRootId,
                                  detach=True)
        runnable.caughtException.connect(self.gui.popupErrorCallback)
        runnable.finished.connect(self.refreshProject)
        runnable.runOnGlobalInstance()
コード例 #9
0
 def flagsRule(self, index):
     row = index.row()
     if (index.column() == COLUMN.VALUE and
         (row == RULE_ROW.NAME or row == RULE_ROW.VARIABLE or row == RULE_ROW.MATH)):
         return Qt.ItemFlags(QAbstractTableModel.flags(self, index) | Qt.ItemIsEditable)
     else:
         return None
コード例 #10
0
 def flagsEvent(self, index):
     row = index.row()
     if (index.column() == COLUMN.VALUE and
         (row == EVENT_ROW.NAME or row == EVENT_ROW.TARGET or row == EVENT_ROW.EXPRESSION or row == EVENT_ROW.TRIGGEREXPRESSION)):
         return Qt.ItemFlags(QAbstractTableModel.flags(self, index) | Qt.ItemIsEditable)
     else:
         return None
コード例 #11
0
 def flags(self, index):
     if not index.isValid():
         return Qt.ItemIsEnabled
     sresult = super(ItemTableModel,self).flags(index)
     result = sresult | Qt.ItemIsEnabled | Qt.ItemIsSelectable
     if index.column() == 1:
         result = result | Qt.ItemIsEditable
     return Qt.ItemFlags(result)
コード例 #12
0
    def testEqual(self):
        '''QFlags == operator'''
        flags = Qt.Window
        flags |= Qt.WindowMinimizeButtonHint
        flag_type = (flags & Qt.WindowType_Mask)
        self.assertEqual(flag_type, Qt.Window)

        self.assertEqual(Qt.KeyboardModifiers(Qt.ControlModifier),
                         Qt.ControlModifier)
コード例 #13
0
 def testIOr(self):
     '''QFlags |= (ior) operator'''
     flag = Qt.WindowFlags()
     self.assertTrue(Qt.Widget == 0)
     self.assertFalse(flag & Qt.Widget)
     result = flag & Qt.Widget
     self.assertTrue(result == 0)
     flag |= Qt.WindowMinimizeButtonHint
     self.assertTrue(flag & Qt.WindowMinimizeButtonHint)
コード例 #14
0
 def flagsGeneral(self, index):
     row = index.row()
     if index.column(
     ) == COLUMN.VALUE and row == 1:  # 1 is hardcoded; "Name" always has to be at 2nd position
         return Qt.ItemFlags(
             QAbstractTableModel.flags(self, index) | Qt.ItemIsEditable)
     else:
         #return Qt.ItemFlags(QAbstractTableModel.flags(self, index))
         return None
コード例 #15
0
ファイル: tablemodel.py プロジェクト: rjones30/rcdb
 def flags(self, index):
     """ Set the item flags at the given index. Seems like we're 
         implementing this function just to see how it's done, as we 
         manually adjust each tableView to have NoEditTriggers.
     """
     if not index.isValid():
         return Qt.ItemIsEnabled
     return Qt.ItemFlags(
         QAbstractTableModel.flags(self, index) | Qt.ItemIsEditable)
コード例 #16
0
    def __init__(self, system):
        super(QtMolecularViewer, self).__init__()
        self.actions = {}

        self.system = system

        self.widget.clicked.connect(self.on_click)
        # Let's add some dock
        self.controls = QtGui.QDockWidget()
        # Eliminate the dock titlebar
        title_widget = QtGui.QWidget(self)
        self.controls.setTitleBarWidget(title_widget)
        hb = QtGui.QHBoxLayout()  # For controls

        self.keys = {}

        self.actions['action1'] = QtGui.QPushButton('action1')
        self.actions['action2'] = QtGui.QPushButton('action2')
        # Sidebar definition

        dock1 = QtGui.QDockWidget()
        bt1 = IconButton(os.path.join(resources_dir, 'select_atoms.svg'),
                         'Select all atoms')
        bt2 = IconButton(os.path.join(resources_dir, 'select_molecules.svg'),
                         'Select all molecules')
        bt3 = IconButton(os.path.join(resources_dir, 'hide_icon.svg'),
                         'Hide selected')
        bt4 = IconButton(os.path.join(resources_dir, 'show_icon.svg'),
                         'Show selected')

        self.actions['select_all_atoms'] = bt1
        self.actions['select_all_molecules'] = bt2
        self.actions['hide'] = bt3
        self.actions['show'] = bt4

        layout = QtGui.QGridLayout()
        layout.addWidget(bt1, 0, 0, Qt.AlignLeft)
        layout.addWidget(bt2, 0, 1, Qt.AlignLeft)
        layout.addWidget(bt3, 1, 0, Qt.AlignLeft)
        layout.addWidget(bt4, 1, 1, Qt.AlignLeft)

        layout.setColumnStretch(3, 1)
        layout.setRowStretch(2, 1)

        wrapper = QtGui.QWidget()
        wrapper.setLayout(layout)
        dock1.setWidget(wrapper)
        wrapper.setFixedSize(150, 100)
        self.addDockWidget(Qt.DockWidgetArea(Qt.RightDockWidgetArea), dock1)

        self._repr_controls = QtGui.QDockWidget()
        self.addDockWidget(Qt.RightDockWidgetArea, self._repr_controls)

        #self.add_representation(VdWRepresentation)
        self.add_representation(BallAndStickRepresentation)
コード例 #17
0
ファイル: ui.py プロジェクト: miitcher/PacmanClone
    def keyPressed(self, currentWidget, e):
        self.currentWidget = str(currentWidget)
        self.pressedKey = str(Qt.Key(e.key())).split(".")[-1]
        #print(self.pressedKey, self.currentWidget, self.MWindow.settings.findKeyMeaning(self.pressedKey))

        if self.currentWidget == "GameW" and self.MWindow.settings.findKeyMeaning(
                self.pressedKey) == "Pause":
            self.MWindow.GameW.pauseOrUnpauseGame()
        elif self.MWindow.settings.findKeyMeaning(self.pressedKey) == "Esc":
            if self.currentWidget != "MenuW":
                self.MWindow.toMenuW()
コード例 #18
0
    def __init__(self, parent):
        super(QuickTree, self).__init__(parent)

        self.loadedItems = {}
        self.itemClass = QuickTreeItem
        self.defaultFlags = Qt.ItemFlags(Qt.ItemIsSelectable |
                                         Qt.ItemIsUserCheckable |
                                         Qt.ItemIsEnabled)
        self.defaultRoles = {}

        self.setItemDelegate(QuickTreeItemDelegate(self))
        self._connectSignals()
コード例 #19
0
    def match(self,
              start,
              role,
              value,
              hits=1,
              flags=Qt.MatchFlags(Qt.MatchStartsWith | Qt.MatchWrap)):
        if self.sourceModel() is None:
            return []

        start = self.mapToSource(start)
        sourceList = self.sourceModel().match(start, role, value, hits, flags)
        proxyList = []
        for cursor in sourceList:
            proxyList.append(self.mapFromSource(cursor))
        return proxyList
コード例 #20
0
    def flags(self, index):
        if not index.isValid():
            return Qt.ItemIsEnabled
        flags = 0
        column = self._columns[index.column()]
        if column.editable:
            flags |= Qt.ItemIsEditable
        if column.selectable:
            flags |= Qt.ItemIsSelectable
        if column.checkable:
            flags |= Qt.ItemIsUserCheckable
        if column.enabled:
            flags |= Qt.ItemIsEnabled
        if column.tristate:
            flags |= Qt.ItemIsTristate

        flags |= QtCore.Qt.ItemIsDragEnabled
        flags |= QtCore.Qt.ItemIsDropEnabled

        return Qt.ItemFlags(
            QtCore.QAbstractTableModel.flags(self, index) | flags)
コード例 #21
0
    def on_comboBox_interface_currentIndexChanged(self, text):
        self.ui.comboBox_channel.clear()

        if text == 'pcan':
            self.ui.comboBox_channel.addItems([
                'PCAN_USBBUS1', 'PCAN_USBBUS2', 'PCAN_USBBUS3', 'PCAN_USBBUS4',
                'PCAN_USBBUS5', 'PCAN_USBBUS6', 'PCAN_USBBUS7', 'PCAN_USBBUS8',
                'PCAN_ISABUS1', 'PCAN_ISABUS2', 'PCAN_ISABUS3', 'PCAN_ISABUS4',
                'PCAN_ISABUS5', 'PCAN_ISABUS6', 'PCAN_ISABUS7', 'PCAN_ISABUS8',
                'PCAN_DNGBUS1', 'PCAN_PCIBUS1', 'PCAN_PCIBUS2', 'PCAN_PCIBUS3',
                'PCAN_PCIBUS4', 'PCAN_PCIBUS5', 'PCAN_PCIBUS6', 'PCAN_PCIBUS7',
                'PCAN_PCIBUS8', 'PCAN_PCCBUS1', 'PCAN_PCCBUS2'
            ])

        cfg = can.util.load_config()
        if cfg['interface'] == text:
            index = self.ui.comboBox_channel.findText(cfg['channel'],
                                                      flags=Qt.MatchFlag(
                                                          Qt.MatchFixedString))
            if index >= 0:
                self.ui.comboBox_channel.setCurrentIndex(index)
コード例 #22
0
ファイル: qttrajectory.py プロジェクト: ajjackson/chemlab
    def __init__(self):
        super(QtTrajectoryViewer, self).__init__()
        
        self.controls = QDockWidget()
        
        # Eliminate the dock titlebar
        title_widget = QtGui.QWidget(self)
        self.controls.setTitleBarWidget(title_widget)
        
        traj_controls = TrajectoryControls(self)
        self.controls.setWidget(traj_controls)
        
        # Molecular viewer
        self.widget = QChemlabWidget(self)
        self.setCentralWidget(self.widget)
        self.addDockWidget(Qt.DockWidgetArea(Qt.BottomDockWidgetArea),
                           self.controls)

        self.show()
        # Replace in this way
        
        traj_controls.frame_changed.connect(self.on_frame_changed)
        self.traj_controls = traj_controls
コード例 #23
0
    def __init__(self,
                 iconDirectory,
                 widgetToFocus,
                 parent=None,
                 flags=Qt.WindowFlags()):
        """
        TOWRITE

        :param `iconDirectory`: TOWRITE
        :type `iconDirectory`: QString
        :param `widgetToFocus`: TOWRITE
        :type `widgetToFocus`: QWidget
        :param `parent`: TOWRITE
        :type `parent`: QWidget
        :param `flags`: TOWRITE
        :type `flags`: Qt.WindowFlags
        """
        super(UndoEditor, self).__init__(parent, flags)

        self.iconDir = iconDirectory
        self.iconSize = 16
        self.setMinimumSize(100, 100)

        self.undoGroup = QUndoGroup(self)
        self.undoView = QUndoView(self.undoGroup, self)
        self.undoView.setEmptyLabel(self.tr("New"))
        self.undoView.setCleanIcon(
            QIcon(self.iconDir + os.sep + "new.png")
        )  # TODO: new.png for new drawings, open.png for opened drawings, save.png for saved/cleared drawings?

        self.setWidget(self.undoView)
        self.setWindowTitle(self.tr("History"))
        self.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)

        self.setFocusProxy(widgetToFocus)
        self.undoView.setFocusProxy(widgetToFocus)
コード例 #24
0
class ItemUserFlag:
    MultiEditable = Qt.ItemFlag(128)
コード例 #25
0
    def __init__(self, parent=None, **kw):
        # the current button
        self._ActiveButton = Qt.NoButton

        # private attributes
        self.__saveX = 0
        self.__saveY = 0
        self.__saveModifiers = Qt.NoModifier
        self.__saveButtons = Qt.NoButton
        self.__wheelDelta = 0

        # do special handling of some keywords:
        # stereo, rw

        try:
            stereo = bool(kw['stereo'])
        except KeyError:
            stereo = False

        try:
            rw = kw['rw']
        except KeyError:
            rw = None

        # create base qt-level widget
        if "wflags" in kw:
            wflags = kw['wflags']
        else:
            wflags = Qt.WindowFlags()
        QWidget.__init__(self, parent, wflags | Qt.MSWindowsOwnDC)

        if rw:  # user-supplied render window
            self._RenderWindow = rw
        else:
            self._RenderWindow = vtk.vtkRenderWindow()

        WId = self.winId()

        # Python2
        if type(WId).__name__ == 'PyCObject':
            from ctypes import pythonapi, c_void_p, py_object

            pythonapi.PyCObject_AsVoidPtr.restype = c_void_p
            pythonapi.PyCObject_AsVoidPtr.argtypes = [py_object]

            WId = pythonapi.PyCObject_AsVoidPtr(WId)

        # Python3
        elif type(WId).__name__ == 'PyCapsule':
            from ctypes import pythonapi, c_void_p, py_object, c_char_p

            pythonapi.PyCapsule_GetName.restype = c_char_p
            pythonapi.PyCapsule_GetName.argtypes = [py_object]

            name = pythonapi.PyCapsule_GetName(WId)

            pythonapi.PyCapsule_GetPointer.restype = c_void_p
            pythonapi.PyCapsule_GetPointer.argtypes = [py_object, c_char_p]

            WId = pythonapi.PyCapsule_GetPointer(WId, name)

        self._RenderWindow.SetWindowInfo(str(int(WId)))

        if stereo:  # stereo mode
            self._RenderWindow.StereoCapableWindowOn()
            self._RenderWindow.SetStereoTypeToCrystalEyes()

        try:
            self._Iren = kw['iren']
        except KeyError:
            self._Iren = vtk.vtkGenericRenderWindowInteractor()
            self._Iren.SetRenderWindow(self._RenderWindow)

        # do all the necessary qt setup
        self.setAttribute(Qt.WA_OpaquePaintEvent)
        self.setAttribute(Qt.WA_PaintOnScreen)
        self.setMouseTracking(True)  # get all mouse events
        self.setFocusPolicy(Qt.WheelFocus)
        self.setSizePolicy(
            QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))

        self._Timer = QTimer(self)
        self._Timer.timeout.connect(self.TimerEvent)

        self._Iren.AddObserver('CreateTimerEvent', self.CreateTimer)
        self._Iren.AddObserver('DestroyTimerEvent', self.DestroyTimer)
        self._Iren.GetRenderWindow().AddObserver('CursorChangedEvent',
                                                 self.CursorChangedEvent)

        #Create a hidden child widget and connect its destroyed signal to its
        #parent ``Finalize`` slot. The hidden children will be destroyed before
        #its parent thus allowing cleanup of VTK elements.
        self._hidden = QWidget(self)
        self._hidden.hide()
        self._hidden.destroyed.connect(self.Finalize)
コード例 #26
0
 def expandingDirections(self):
     return Qt.Orientations(Qt.Orientation(0))
コード例 #27
0
    def __init__(self):
        super(QtMolecularViewer, self).__init__()
        self.actions = {}

        self.widget.background_color = colors.black

        #####################################
        #  This is all UI stuff
        #####################################
        self.widget.clicked.connect(self.on_click)
        # Let's add some dock
        self.controls = QtGui.QDockWidget()
        # Eliminate the dock titlebar
        title_widget = QtGui.QWidget(self)
        self.controls.setTitleBarWidget(title_widget)
        hb = QtGui.QHBoxLayout()  # For controls

        self.keys = {}

        self.actions['action1'] = QtGui.QPushButton('action1')
        self.actions['action2'] = QtGui.QPushButton('action2')
        # Sidebar definition

        dock1 = QtGui.QDockWidget()
        dock2 = QtGui.QDockWidget()

        bt1 = IconButton(os.path.join(resources_dir, 'select_atoms.svg'),
                         'Select all atoms')
        bt2 = IconButton(os.path.join(resources_dir, 'select_molecules.svg'),
                         'Select all molecules')
        bt3 = IconButton(os.path.join(resources_dir, 'hide_icon.svg'),
                         'Hide selected')
        bt4 = IconButton(os.path.join(resources_dir, 'show_icon.svg'),
                         'Show selected')

        self.actions['select_all_atoms'] = bt1
        self.actions['select_all_molecules'] = bt2
        self.actions['hide'] = bt3
        self.actions['show'] = bt4

        layout = QtGui.QGridLayout()
        layout.addWidget(bt1, 0, 0, Qt.AlignLeft)
        layout.addWidget(bt2, 0, 1, Qt.AlignLeft)
        layout.addWidget(bt3, 1, 0, Qt.AlignLeft)
        layout.addWidget(bt4, 1, 1, Qt.AlignLeft)

        layout.setColumnStretch(3, 1)
        layout.setRowStretch(2, 1)

        wrapper = QtGui.QWidget()
        wrapper.setLayout(layout)
        dock1.setWidget(wrapper)

        self.ipython = QIPythonWidget()
        self.ipython.initialize()

        wrapper2 = QtGui.QWidget(self)
        vb = QtGui.QVBoxLayout(self)
        vb.setSizeConstraint(QtGui.QLayout.SetMaximumSize)

        self.traj_controls = TrajectoryControls()
        vb.addWidget(self.traj_controls, 1)
        vb.addWidget(self.ipython, 2)
        wrapper2.setLayout(vb)

        dock2.setWidget(wrapper2)
        wrapper.setFixedSize(150, 100)

        self.addDockWidget(Qt.DockWidgetArea(Qt.RightDockWidgetArea), dock1)
        self.addDockWidget(Qt.DockWidgetArea(Qt.BottomDockWidgetArea), dock2)

        self._repr_controls = QtGui.QDockWidget()

        self.addDockWidget(Qt.RightDockWidgetArea, self._repr_controls)

        ############################################
        # Initialization code
        ############################################

        self.namespace = self.ipython.get_user_namespace()
        self.namespace['__builtins__'].viewer = self

        #self.ipython.app.shell.ex('import sys')
        #self.ipython.app.shell.ex('''sys.path.append('/home/gabriele/workspace/chemlab/toolboxes/')''')
        self.ipython.app.shell.ex(
            'from chemlab.mviewer.toolboxes.init import *')
コード例 #28
0
 def flags(self, index):
     if not index.isValid():
         return Qt.ItemIsEnabled
     return Qt.ItemFlags(
         QAbstractTableModel.flags(self, index) | Qt.ItemIsEditable)
コード例 #29
0
    def __init__(self):
        super(QtTrajectoryViewer, self).__init__()

        self.controls = QDockWidget()
        self._timer = QtCore.QTimer(self)
        self._timer.timeout.connect(self.do_update)

        # Eliminate the dock titlebar
        title_widget = QtGui.QWidget(self)
        self.controls.setTitleBarWidget(title_widget)

        vb = QtGui.QVBoxLayout()
        hb = QtGui.QHBoxLayout()  # For controls

        containerhb2 = QtGui.QWidget(self)

        hb2 = QtGui.QHBoxLayout()  # For settings
        containerhb2.setLayout(hb2)
        containerhb2.setSizePolicy(QtGui.QSizePolicy.Minimum,
                                   QtGui.QSizePolicy.Minimum)

        vb.addWidget(containerhb2)
        vb.addLayout(hb)
        self.vb = vb

        # Settings buttons
        hb2.addWidget(QtGui.QLabel('Speed'))
        self._speed_slider = QtGui.QSlider(Qt.Horizontal)
        self._speed_slider.resize(100, self._speed_slider.height())
        self._speed_slider.setSizePolicy(QtGui.QSizePolicy.Fixed,
                                         QtGui.QSizePolicy.Fixed)

        self.speeds = np.linspace(15, 250, 11).astype(int)
        self.speeds = self.speeds.tolist()
        self.speeds.reverse()
        self._speed_slider.setMaximum(10)
        self._speed_slider.setValue(7)
        self._speed_slider.valueChanged.connect(self.on_speed_changed)

        hb2.addWidget(self._speed_slider)
        hb2.addStretch(1)

        wrapper = QtGui.QWidget()
        wrapper.setLayout(vb)

        # Molecular viewer
        self.widget = QChemlabWidget(self)
        self.setCentralWidget(self.widget)

        # Control buttons
        self.play_stop = PlayStopButton()
        hb.addWidget(self.play_stop)

        self.slider = AnimationSlider()
        hb.addWidget(self.slider, 2)

        self._label_tmp = '<b><FONT SIZE=30>{}</b>'
        self.timelabel = QtGui.QLabel(self._label_tmp.format('0.0'))
        hb.addWidget(self.timelabel)

        self._settings_button = QtGui.QPushButton()
        self._settings_button.setStyleSheet('''
                                 QPushButton {
                                     width: 30px;
                                     height: 30px;
                                 }''')
        icon = QtGui.QIcon(os.path.join(resources_dir, 'settings_icon.svg'))
        self._settings_button.setIcon(icon)
        self._settings_button.clicked.connect(self._toggle_settings)

        hb.addWidget(self._settings_button)

        self.controls.setWidget(wrapper)
        self.addDockWidget(Qt.DockWidgetArea(Qt.BottomDockWidgetArea),
                           self.controls)

        self._settings_pan = containerhb2
        self.show()

        self.speed = self.speeds[self._speed_slider.value()]
        # Connecting all the signals
        self.play_stop.play.connect(self.on_play)
        self.play_stop.pause.connect(self.on_pause)

        self.slider.valueChanged.connect(self.on_slider_change)
        self.slider.sliderPressed.connect(self.on_slider_down)

        self.play_stop.setFocus()
        vb.setSizeConstraint(QtGui.QLayout.SetMaximumSize)
        containerhb2.setVisible(False)