Пример #1
0
    def __init__(self, theme=None, stylesheet=None):
        super(VCPApplication, self).__init__(qtpyvcp.OPTIONS.command_line_args
                                             or [])

        opts = qtpyvcp.OPTIONS

        from qtpyvcp.core import Prefs, Info
        self.info = Info()
        self.prefs = Prefs()
        self.status = getPlugin('status')

        self.initialiseDataPlugins()

        theme = opts.theme or theme
        if theme is not None:
            self.setStyle(QStyleFactory.create(theme))

        stylesheet = opts.stylesheet or stylesheet
        if stylesheet is not None:
            self.loadStylesheet(stylesheet)

        # self.window = self.loadVCPMainWindow(opts, vcp_file)
        # if self.window is not None:
        #     self.window.show()

        # Performance monitoring
        if opts.perfmon:
            import psutil
            self.perf = psutil.Process()
            self.perf_timer = QTimer()
            self.perf_timer.setInterval(2000)
            self.perf_timer.timeout.connect(self.logPerformance)
            self.perf_timer.start()

        self.aboutToQuit.connect(self.terminate)
Пример #2
0
    def __init__(self, *args, **kwargs):
        super(SplitGridView, self).__init__(*args, **kwargs)

        self.top_splitter = QSplitter(Qt.Horizontal)
        self.top_splitter.setSizes([100, 200])

        self.bottom_splitter = QSplitter(Qt.Horizontal)
        self.bottom_splitter.setSizes([100, 200])

        # connect splitter1 and splitter2 to move together
        # TODO which version is desired? connect splitter or free moving?
        # self.top_splitter.splitterMoved.connect(self.moveSplitter)
        # self.bottom_splitter.splitterMoved.connect(self.moveSplitter)
        # self._spltA = self.top_splitter
        # self._spltB = self.bottom_splitter

        self.outer_splitter = QSplitter(Qt.Vertical)
        self.outer_splitter.insertWidget(0, self.top_splitter)
        self.outer_splitter.insertWidget(1, self.bottom_splitter)
        self.outer_splitter.setSizes([200, 400])

        self.layout.addWidget(self.outer_splitter)
        self.setLayout(self.layout)
        QApplication.setStyle(QStyleFactory.create('Cleanlooks'))
        self.setGeometry(300, 300, 300, 200)

        self.max_canvases = 4

        self.icon = QIcon(path('icons/2x2grid.png'))
Пример #3
0
    def __init__(self, *args, **kwargs):
        super(SplitGridView, self).__init__(*args, **kwargs)

        self.top_splitter = QSplitter(Qt.Horizontal)
        self.top_splitter.setSizes([100, 200])

        self.bottom_splitter = QSplitter(Qt.Horizontal)
        self.bottom_splitter.setSizes([100, 200])

        # connect splitter1 and splitter2 to move together
        # TODO which version is desired? connect splitter or free moving?
        # self.top_splitter.splitterMoved.connect(self.moveSplitter)
        # self.bottom_splitter.splitterMoved.connect(self.moveSplitter)
        # self._spltA = self.top_splitter
        # self._spltB = self.bottom_splitter

        self.outer_splitter = QSplitter(Qt.Vertical)
        self.outer_splitter.insertWidget(0, self.top_splitter)
        self.outer_splitter.insertWidget(1, self.bottom_splitter)
        self.outer_splitter.setSizes([200, 400])

        self.layout.addWidget(self.outer_splitter)
        self.setLayout(self.layout)
        QApplication.setStyle(QStyleFactory.create('Cleanlooks'))
        self.setGeometry(300, 300, 300, 200)

        self.max_canvases = 4

        # Set attrs for when the buttons are created
        self.icon = QIcon(path('icons/2x2grid.png'))
        self.tool_tip = "2x2 Grid View"
        self.whats_this = "Displays up to four visualized data items in a grid layout."
Пример #4
0
    def initUi(self):
        print('Initializing GUI...')
        w, h = 1000, 1000

        self.find = ZhuNoteFind(self)  # self as parent
        self.tree = ZhuNoteTree()
        self.form = ZhuNoteForm(self.path)
        self.wbrs = QWebEngineView()

        splitter1 = QSplitter(Qt.Horizontal)
        splitter1.addWidget(self.form)
        splitter1.addWidget(self.wbrs)
        splitter1.setSizes([w / 2, w / 2])

        splitter = QSplitter(Qt.Vertical)
        splitter.addWidget(self.tree)
        splitter.addWidget(splitter1)
        splitter.setStretchFactor(0, 1)
        splitter.setStretchFactor(1, 2)

        vbox = QVBoxLayout()
        vbox.addWidget(self.find)
        vbox.addWidget(splitter)
        self.setLayout(vbox)

        self.wbrs.setHtml(self.html_hi)

        self.tree.sigViewItem.connect(self.form.viewDict)
        self.tree.sigViewItem.connect(self.viewHtml)
        self.find.sigClear.connect(self.clear)
        self.find.sigString.connect(self.search)
        self.find.sigUpdateMaster.connect(self.updateMaster)
        self.find.sigFont.connect(self.setFont)

        self.setWindowTitle('Main - ZhuNote')
        #self.setGeometry(x, y, w, h)
        #self.move(x, y)
        self.resize(w, h)
        #self.show()
        #self.tree.show()
        #self.form.show()

        styleName = 'Cleanlooks'  # QStyleFactory.keys()
        # ['Windows', 'Motif', 'CDE', 'Plastique', 'GTK+', 'Cleanlooks']
        QApplication.setStyle(QStyleFactory.create(styleName))

        self.find.txtSearch.setFocus()  # not work yet

        self.actExit = QAction('Exit', self)
        self.actExit.setShortcut('Ctrl+Q')
        self.actExit.triggered.connect(self.closeAllWindows)
        self.addAction(self.actExit)
Пример #5
0
    def __init__(self, *args, **kwargs):
        super(SplitHorizontal, self).__init__(*args, **kwargs)

        self.splitter = QSplitter(Qt.Vertical)
        self.splitter.setSizes([100, 200])

        self.layout.addWidget(self.splitter)
        self.setLayout(self.layout)
        QApplication.setStyle(QStyleFactory.create('Cleanlooks'))
        self.setGeometry(300, 300, 300, 200)

        self.max_canvases = 2

        self.icon = QIcon(path('icons/1x1hor.png'))
Пример #6
0
 def __init__(self, path=None):
     QWidget.__init__(self)
     self.setWindowTitle(self.NAME)
     self.setWindowIcon(APP_ICON)
     self.games = None  # pandas dataframe
     self.ranks = None  # pandas dataframe
     self.fn_players = None
     self.fn_games = None
     self.rank_order = 1  # descending
     self.rank_column = 1
     if path is None:
         path = os.getcwd()
     self.path = path
     self.setup_page()
     QApplication.setStyle(QStyleFactory.create('Cleanlooks'))
Пример #7
0
    def __init__(self, *args, **kwargs):
        super(SplitThreeView, self).__init__(*args, **kwargs)

        self.top_splitter = QSplitter(Qt.Horizontal)
        self.top_splitter.setSizes([100, 200])

        self.outer_splitter = QSplitter(Qt.Vertical)
        self.outer_splitter.insertWidget(0, self.top_splitter)

        self.layout.addWidget(self.outer_splitter)
        self.setLayout(self.layout)
        QApplication.setStyle(QStyleFactory.create('Cleanlooks'))
        self.setGeometry(300, 300, 300, 200)

        self.max_canvases = 3

        self.icon = QIcon(path('icons/2x1grid.png'))
Пример #8
0
    def __init__(self, *args, **kwargs):
        super(SplitHorizontal, self).__init__(*args, **kwargs)

        self.splitter = QSplitter(Qt.Vertical)
        self.splitter.setSizes([100, 200])

        self.layout.addWidget(self.splitter)
        self.setLayout(self.layout)
        QApplication.setStyle(QStyleFactory.create('Cleanlooks'))
        self.setGeometry(300, 300, 300, 200)

        self.max_canvases = 2

        # Set attrs for when the buttons are created
        self.icon = QIcon(path('icons/1x1hor.png'))
        self.tool_tip = "Horizontal Split View"
        self.whats_this = "Displays up to two visualized data items in a horizontal layout."
Пример #9
0
    def __init__(self, theme=None, stylesheet=None, custom_fonts=[]):
        app_args = (qtpyvcp.OPTIONS.command_line_args or "").split()
        super(VCPApplication, self).__init__(app_args)

        opts = qtpyvcp.OPTIONS

        self.status = getPlugin('status')

        # initialize plugins
        initialisePlugins()

        theme = opts.theme or theme
        if theme is not None:
            self.setStyle(QStyleFactory.create(theme))

        stylesheet = opts.stylesheet or stylesheet
        if stylesheet is not None:
            self.loadStylesheet(stylesheet, opts.develop)

        if custom_fonts:
            if isinstance(custom_fonts, str):  # single font or location
                self.loadCustomFont(custom_fonts)
            else:  # list of fonts or locations
                for font in custom_fonts:
                    self.loadCustomFont(font)

        # self.window = self.loadVCPMainWindow(opts, vcp_file)
        # if self.window is not None:
        #     self.window.show()

        if opts.hide_cursor:
            from qtpy.QtGui import QCursor
            self.setOverrideCursor(QCursor(Qt.BlankCursor))

        # Performance monitoring
        if opts.perfmon:
            import psutil
            self.perf = psutil.Process()
            self.perf_timer = QTimer()
            self.perf_timer.setInterval(2000)
            self.perf_timer.timeout.connect(self.logPerformance)
            self.perf_timer.start()

        self.aboutToQuit.connect(self.terminate)
Пример #10
0
    def __init__(self, *args, **kwargs):
        super(SplitThreeView, self).__init__(*args, **kwargs)

        self.top_splitter = QSplitter(Qt.Horizontal)
        self.top_splitter.setSizes([100, 200])

        self.outer_splitter = QSplitter(Qt.Vertical)
        self.outer_splitter.insertWidget(0, self.top_splitter)

        self.layout.addWidget(self.outer_splitter)
        self.setLayout(self.layout)
        QApplication.setStyle(QStyleFactory.create('Cleanlooks'))
        self.setGeometry(300, 300, 300, 200)

        self.max_canvases = 3

        # Set attrs for when the buttons are created
        self.icon = QIcon(path('icons/2x1grid.png'))
        self.tool_tip = "3-Way Split View"
        self.whats_this = "Displays up to three visualized data items."
Пример #11
0
        vcp_name = selection[0].data()
        vcp = self._vcp_data[vcp_name].get('entry_point_name', '')

        self.opts.vcp = vcp
        self.accept()

    @Slot()
    def on_cancelButton_clicked(self):
        self.reject()

    @Slot()
    def on_fileButton_pressed(self):
        vcp_file = QFileDialog.getOpenFileName(
            self,
            caption="Select VCP File",
            directory=EXAMPLE_VCP_DIR,
            filter='VCP Files (*.yml *.yaml *.ui);; All files (*)',
            options=QFileDialog.DontUseNativeDialog)[0]

        if vcp_file != '':
            self.opts.vcp = vcp_file
            self.accept()


if __name__ == '__main__':
    import sys
    app = QApplication(sys.argv)
    app.setStyle(QStyleFactory.create('Windows'))
    launcher = VCPChooser()
    sys.exit(app.exec_())
Пример #12
0
 def changeStyle(self, styleName):
     QApplication.setStyle(QStyleFactory.create(styleName))
     self.changePalette()
Пример #13
0
 def __init__(self):
     QApplication.setStyle(QStyleFactory.create("Cleanlooks"))
     QMainWindow.__init__(self)
     autoNOM.Ui_MainWindow.__init__(self)
     self.setupUi(self)
Пример #14
0
    def __init__(self):
        QApplication.setStyle(QStyleFactory.create("Cleanlooks"))
        QMainWindow.__init__(self)
        self.setupUi(self)

        init_step1 = InitStep1(parent=self)
Пример #15
0
    def apply_settings(self, options):
        self.set_option('selected', self.current_scheme)
        color_scheme = self.get_option('selected')
        ui_theme = self.get_option('ui_theme')
        style_sheet = self.main.styleSheet()
        if ui_theme == 'automatic':
            if ((not is_dark_font_color(color_scheme) and not style_sheet)
                    or (is_dark_font_color(color_scheme) and style_sheet)):
                self.changed_options.add('ui_theme')
            elif 'ui_theme' in self.changed_options:
                self.changed_options.remove('ui_theme')

            if 'ui_theme' not in self.changed_options:
                self.main.editor.apply_plugin_settings(['color_scheme_name'])
                if self.main.ipyconsole is not None:
                    self.main.ipyconsole.apply_plugin_settings(
                        ['color_scheme_name'])

                for plugin in self.main.thirdparty_plugins:
                    try:
                        # New API
                        plugin.apply_conf(['color_scheme_name'])
                    except AttributeError:
                        # Old API
                        plugin.apply_plugin_settings(['color_scheme_name'])

                self.update_combobox()
                self.update_preview()
        else:
            if 'ui_theme' in self.changed_options:
                if (style_sheet and ui_theme == 'dark'
                        or not style_sheet and ui_theme == 'light'):
                    self.changed_options.remove('ui_theme')

            if 'ui_theme' not in self.changed_options:
                self.main.editor.apply_plugin_settings(['color_scheme_name'])
                if self.main.ipyconsole is not None:
                    self.main.ipyconsole.apply_plugin_settings(
                        ['color_scheme_name'])

                for plugin in self.main.thirdparty_plugins:
                    try:
                        # New API
                        plugin.apply_conf(['color_scheme_name'])
                    except AttributeError:
                        # Old API
                        plugin.apply_plugin_settings(['color_scheme_name'])

                self.update_combobox()
                self.update_preview()

        qapp = QApplication.instance()
        if 'windows_style' in options:
            style_name = self.get_option('windows_style')
            style = QStyleFactory.create(style_name)
            if style is not None:
                style.setProperty('name', style_name)
                qapp.setStyle(style)

        if self.main.historylog is not None:
            self.main.historylog.apply_conf(['color_scheme_name'])