def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)
        Advisor.__init__(self, parent)
        self.setWindowTitle(u"Openmolar %s"% _("Preferences"))

        self.listwidget = QtGui.QListWidget()
        close_but = QtGui.QPushButton(_("Close"))

        left_frame = QtGui.QFrame()

        layout = QtGui.QVBoxLayout(left_frame)
        layout.addWidget(QtGui.QLabel(_("Preference Options")))
        layout.addWidget(self.listwidget)
        layout.addWidget(close_but)

        self.stackedwidget = QtGui.QStackedWidget(self)

        splitter = QtGui.QSplitter(self)
        splitter.addWidget(left_frame)
        splitter.addWidget(self.stackedwidget)

        self.listwidget.currentRowChanged.connect(
            self.stackedwidget.setCurrentIndex)

        self.add_font_option()

        layout = QtGui.QVBoxLayout(self)
        layout.addWidget(splitter)

        close_but.clicked.connect(self.accept)
Exemple #2
0
    def __init__(self, logger=None, parent=None):
        QtGui.QFrame.__init__(self, parent)
        Advisor.__init__(self)

        self.init_logger(logger)

        self.text_browser = QtGui.QTextEdit()
        self.text_browser.setReadOnly(True)
        self.text_browser.viewport().setStyleSheet("background-color:black")
        self.text_browser.setTextColor(QtGui.QColor(QtCore.Qt.white))
        self.text_browser.setFont(QtGui.QFont("courier", 10))
        self.text_browser.setLineWrapMode(QtGui.QTextEdit.NoWrap)

        verbosity_box = QtGui.QComboBox(self)
        verbosity_box.addItems([
            _("Verbosity"), "DEBUG (%s)"%_("maximum"),
            "INFO (%s)"%_("default"), "WARNING (%s)"%_("minimum")])
        verbosity_box.currentIndexChanged.connect(self.set_verbosity)

        self.clear_button = QtGui.QPushButton()
        icon = QtGui.QIcon.fromTheme("edit-clear")
        self.clear_button.setIcon(icon)
        self.clear_button.setText(_("Clear"))

        save_button = QtGui.QPushButton()
        icon = QtGui.QIcon.fromTheme("document-save")
        save_button.setIcon(icon)
        save_button.setText(_("Save to file"))

        print_button = QtGui.QPushButton()
        icon = QtGui.QIcon.fromTheme("printer")
        print_button.setIcon(icon)
        print_button.setText(_("Print"))

        frame = QtGui.QFrame()
        layout = QtGui.QHBoxLayout(frame)
        layout.setMargin(0)
        spacer = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Expanding)
        layout.addWidget(verbosity_box)
        layout.addItem(spacer)
        layout.addWidget(self.clear_button)
        layout.addWidget(save_button)
        layout.addWidget(print_button)

        layout = QtGui.QVBoxLayout(self)
        layout.setMargin(3)
        layout.setSpacing(2)
        layout.addWidget(self.text_browser)

        layout.addWidget(frame)

        self.clear_button.clicked.connect(self.clear)
        save_button.clicked.connect(self.save)
        print_button.clicked.connect(self.print_)

        #use the signal/slot mechanism to ensure thread safety.
        self.connect(self, QtCore.SIGNAL("LOG"), self._log)
        self.connect(self, QtCore.SIGNAL("EXC"), self._exc)

        self.dirty = False
Exemple #3
0
    def __init__(self, parent=None):

        QtGui.QMainWindow.__init__(self, parent)
        Advisor.__init__(self, parent)

        sys.excepthook = self.excepthook

        self.setMinimumSize(300, 300)

        # setup menu and headers                              ####

        #: a pointer to the main toolbar
        self.main_toolbar = QtGui.QToolBar()
        self.main_toolbar.setObjectName("Main Toolbar")
        self.main_toolbar.toggleViewAction().setText(_("Toolbar"))

        #: a pointer to the :doc:`DockableMenuBar`
        menubar = DockableMenuBar(self)

        # add them to the app
        self.setMenuBar(menubar)

        self.addToolBar(QtCore.Qt.TopToolBarArea, self.main_toolbar)

        # setup a statusbar with a label                       ####

        #: a pointer to the QtGui.QStatusBar
        self.statusbar = QtGui.QStatusBar()
        self.setStatusBar(self.statusbar)

        #: a pointer to the label in the statusbar
        self.status_label = QtGui.QLabel()
        self.statusbar.addPermanentWidget(self.status_label)

        #: a pointer to the File menu
        self.menu_file = QtGui.QMenu(_("&File"), self)
        menubar.addMenu(self.menu_file)

        #: a pointer to the Edit menu
        self.menu_edit = QtGui.QMenu(_("&Edit"), self)
        menubar.addMenu(self.menu_edit)

        #: a pointer to the View menu of :attr:`menubar`
        self.menu_view = menubar.menu_view

        #: a pointer to the Help menu
        self.menu_help = QtGui.QMenu(_("&Help"), self)
        menubar.addMenu(self.menu_help)

        # file menu                                            ####

        icon = QtGui.QIcon.fromTheme("application-exit")

        #: a pointer to the quit qaction
        self.action_quit = QtGui.QAction(icon, _("Quit"), self)

        self.menu_file.addSeparator()
        self.menu_file.addAction(self.action_quit)

        # edit menu                                             ####

        icon = QtGui.QIcon.fromTheme("preferences-desktop")
        #: a pointer to the preferences qAction
        self.action_preferences = QtGui.QAction(icon, _("&Preferences"), self)

        self.menu_edit.addAction(self.action_preferences)

        # view menu                                             ####

        #: a pointer to the show statusbar qaction
        self.action_show_statusbar = QtGui.QAction(_("Show Status&bar"), self)
        self.action_show_statusbar.setCheckable(True)
        self.action_show_statusbar.setChecked(True)

        icon = QtGui.QIcon.fromTheme("view-fullscreen")
        #: a pointer to the fullscreen mode qaction
        self.action_fullscreen = QtGui.QAction(icon, _("FullScreen Mode"),
                                               self)
        self.action_fullscreen.setCheckable(True)
        self.action_fullscreen.setShortcut("f11")

        self.menu_view.addSeparator()
        self.menu_view.addAction(self.action_show_statusbar)
        self.menu_view.addAction(self.action_fullscreen)

        # about menu                                            ####

        icon = QtGui.QIcon.fromTheme("help-about")
        #: a pointer to the about qaction
        self.action_about = QtGui.QAction(icon, _("About"), self)

        #: a pointer to the about qt qaction
        self.action_about_qt = QtGui.QAction(icon, _("About Qt"), self)

        #: a pointer to the license qaction
        self.action_license = QtGui.QAction(icon, _("License"), self)

        icon = QtGui.QIcon.fromTheme("help", QtGui.QIcon("icons/help.png"))

        #: a pointer to the help qaction
        self.action_help = QtGui.QAction(icon, _("Help"), self)

        self.menu_help.addAction(self.action_about)
        self.menu_help.addAction(self.action_license)
        self.menu_help.addAction(self.action_about_qt)
        self.menu_help.addSeparator()
        self.menu_help.addAction(self.action_help)

        # toolbar                                               ####
        # add selected menu items to the toolbar                ####

        #:
        self.help_toolbar = QtGui.QToolBar()
        self.help_toolbar.setObjectName("help toolbar")
        self.help_toolbar.toggleViewAction().setText(_("Help Toolbar"))
        self.help_toolbar.addAction(self.action_help)
        self.addToolBar(self.help_toolbar)

        self.connect_default_signals()
Exemple #4
0
    def __init__(self, logger=None, parent=None):
        QtGui.QFrame.__init__(self, parent)
        Advisor.__init__(self)

        self.init_logger(logger)

        self.text_browser = QtGui.QTextEdit()
        self.text_browser.setReadOnly(True)
        self.text_browser.viewport().setStyleSheet("background-color:black")
        self.text_browser.setTextColor(QtGui.QColor(QtCore.Qt.white))
        self.text_browser.setFont(QtGui.QFont("courier", 10))
        self.text_browser.setLineWrapMode(QtGui.QTextEdit.NoWrap)

        verbosity_box = QtGui.QComboBox(self)
        verbosity_box.addItems([
            _("Verbosity"),
            "DEBUG (%s)" % _("maximum"),
            "INFO (%s)" % _("default"),
            "WARNING (%s)" % _("minimum")
        ])
        verbosity_box.currentIndexChanged.connect(self.set_verbosity)

        self.clear_button = QtGui.QPushButton()
        icon = QtGui.QIcon.fromTheme("edit-clear")
        self.clear_button.setIcon(icon)
        self.clear_button.setText(_("Clear"))

        save_button = QtGui.QPushButton()
        icon = QtGui.QIcon.fromTheme("document-save")
        save_button.setIcon(icon)
        save_button.setText(_("Save to file"))

        print_button = QtGui.QPushButton()
        icon = QtGui.QIcon.fromTheme("printer")
        print_button.setIcon(icon)
        print_button.setText(_("Print"))

        frame = QtGui.QFrame()
        layout = QtGui.QHBoxLayout(frame)
        layout.setMargin(0)
        spacer = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Expanding)
        layout.addWidget(verbosity_box)
        layout.addItem(spacer)
        layout.addWidget(self.clear_button)
        layout.addWidget(save_button)
        layout.addWidget(print_button)

        layout = QtGui.QVBoxLayout(self)
        layout.setMargin(3)
        layout.setSpacing(2)
        layout.addWidget(self.text_browser)

        layout.addWidget(frame)

        self.clear_button.clicked.connect(self.clear)
        save_button.clicked.connect(self.save)
        print_button.clicked.connect(self.print_)

        #use the signal/slot mechanism to ensure thread safety.
        self.connect(self, QtCore.SIGNAL("LOG"), self._log)
        self.connect(self, QtCore.SIGNAL("EXC"), self._exc)

        self.dirty = False
Exemple #5
0
    def __init__(self, parent=None):

        QtGui.QMainWindow.__init__(self, parent)
        Advisor.__init__(self, parent)

        sys.excepthook = self.excepthook

        self.setMinimumSize(300, 300)

        #####          setup menu and headers                              ####

        #: a pointer to the main toolbar
        self.main_toolbar = QtGui.QToolBar()
        self.main_toolbar.setObjectName("Main Toolbar")
        self.main_toolbar.toggleViewAction().setText(_("Toolbar"))

        #: a pointer to the :doc:`DockableMenuBar`
        menubar = DockableMenuBar(self)

        ## add them to the app
        self.setMenuBar(menubar)

        self.addToolBar(QtCore.Qt.TopToolBarArea, self.main_toolbar)

        ####          setup a statusbar with a label                       ####

        #: a pointer to the QtGui.QStatusBar
        self.statusbar = QtGui.QStatusBar()
        self.setStatusBar(self.statusbar)

        #: a pointer to the label in the statusbar
        self.status_label = QtGui.QLabel()
        self.statusbar.addPermanentWidget(self.status_label)

        #: a pointer to the File menu
        self.menu_file = QtGui.QMenu(_("&File"), self)
        menubar.addMenu(self.menu_file)

        #: a pointer to the Edit menu
        self.menu_edit = QtGui.QMenu(_("&Edit"), self)
        menubar.addMenu(self.menu_edit)

        #: a pointer to the View menu of :attr:`menubar`
        self.menu_view = menubar.menu_view

        #: a pointer to the Help menu
        self.menu_help = QtGui.QMenu(_("&Help"), self)
        menubar.addMenu(self.menu_help)

        ####          file menu                                            ####

        icon = QtGui.QIcon.fromTheme("application-exit")

        #: a pointer to the quit qaction
        self.action_quit = QtGui.QAction(icon, _("Quit"), self)

        self.menu_file.addSeparator()
        self.menu_file.addAction(self.action_quit)

        ####         edit menu                                             ####

        icon = QtGui.QIcon.fromTheme("preferences-desktop")
        #: a pointer to the preferences qAction
        self.action_preferences = QtGui.QAction(icon, _("&Preferences"), self)

        self.menu_edit.addAction(self.action_preferences)

        ####         view menu                                             ####

        #: a pointer to the show statusbar qaction
        self.action_show_statusbar = QtGui.QAction(_("Show Status&bar"), self)
        self.action_show_statusbar.setCheckable(True)
        self.action_show_statusbar.setChecked(True)

        icon = QtGui.QIcon.fromTheme("view-fullscreen")
        #: a pointer to the fullscreen mode qaction
        self.action_fullscreen = QtGui.QAction(icon, _("FullScreen Mode"), self)
        self.action_fullscreen.setCheckable(True)
        self.action_fullscreen.setShortcut("f11")

        self.menu_view.addSeparator()
        self.menu_view.addAction(self.action_show_statusbar)
        self.menu_view.addAction(self.action_fullscreen)

        ####         about menu                                            ####

        icon = QtGui.QIcon.fromTheme("help-about")
        #: a pointer to the about qaction
        self.action_about = QtGui.QAction(icon, _("About"), self)

        #: a pointer to the about qt qaction
        self.action_about_qt = QtGui.QAction(icon, _("About Qt"), self)

        #: a pointer to the license qaction
        self.action_license = QtGui.QAction(icon, _("License"), self)

        icon = QtGui.QIcon.fromTheme("help", QtGui.QIcon("icons/help.png"))

        #: a pointer to the help qaction
        self.action_help = QtGui.QAction(icon, _("Help"), self)

        self.menu_help.addAction(self.action_about)
        self.menu_help.addAction(self.action_license)
        self.menu_help.addAction(self.action_about_qt)
        self.menu_help.addSeparator()
        self.menu_help.addAction(self.action_help)

        ####         toolbar                                               ####
        ####         add selected menu items to the toolbar                ####

        #:
        self.help_toolbar = QtGui.QToolBar()
        self.help_toolbar.setObjectName("help toolbar")
        self.help_toolbar.toggleViewAction().setText(_("Help Toolbar"))
        self.help_toolbar.addAction(self.action_help)
        self.addToolBar(self.help_toolbar)

        self.connect_default_signals()