Ejemplo n.º 1
0
    def on_vertical_header_color_status_changed(self, use_colors: bool):
        if use_colors == self.use_header_colors:
            return

        self.use_header_colors = use_colors
        header = self.verticalHeader()
        if self.use_header_colors:
            header.setStyle(QStyleFactory.create("Fusion"))
        else:
            header.setStyle(QStyleFactory.create(""))

        self.setVerticalHeader(header)
Ejemplo n.º 2
0
    def changeStyle(self, checked):
        if not checked:
            return

        action = self.sender()
        style = QStyleFactory.create(action.data())
        if not style:
            return

        QApplication.setStyle(style)

        self.setButtonText(self.smallRadioButton, "Small (%d x %d)",
                style, QStyle.PM_SmallIconSize)
        self.setButtonText(self.largeRadioButton, "Large (%d x %d)",
                style, QStyle.PM_LargeIconSize)
        self.setButtonText(self.toolBarRadioButton, "Toolbars (%d x %d)",
                style, QStyle.PM_ToolBarIconSize)
        self.setButtonText(self.listViewRadioButton, "List views (%d x %d)",
                style, QStyle.PM_ListViewIconSize)
        self.setButtonText(self.iconViewRadioButton, "Icon views (%d x %d)",
                style, QStyle.PM_IconViewIconSize)
        self.setButtonText(self.tabBarRadioButton, "Tab bars (%d x %d)",
                style, QStyle.PM_TabBarIconSize)

        self.changeSize()
Ejemplo n.º 3
0
 def _configure_qt_style(self, preferred_styles):
     if preferred_styles is not None:
         for style_key in preferred_styles:
             style = QStyleFactory.create(style_key)
             if style is not None:
                 self.app.setStyle(style)
                 break
Ejemplo n.º 4
0
    def __init__(self, *, win_id, tab_id, tab, private, parent=None):
        super().__init__(parent)
        if sys.platform == 'darwin' and qtutils.version_check('5.4'):
            # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-42948
            # See https://github.com/qutebrowser/qutebrowser/issues/462
            self.setStyle(QStyleFactory.create('Fusion'))
        # FIXME:qtwebengine this is only used to set the zoom factor from
        # the QWebPage - we should get rid of it somehow (signals?)
        self.tab = tab
        self._tabdata = tab.data
        self.win_id = win_id
        self.scroll_pos = (-1, -1)
        self._old_scroll_pos = (-1, -1)
        self._set_bg_color()
        self._tab_id = tab_id

        page = webpage.BrowserPage(win_id=self.win_id, tab_id=self._tab_id,
                                   tabdata=tab.data, private=private,
                                   parent=self)

        try:
            page.setVisibilityState(
                QWebPage.VisibilityStateVisible if self.isVisible()
                else QWebPage.VisibilityStateHidden)
        except AttributeError:
            pass

        self.setPage(page)

        mode_manager = objreg.get('mode-manager', scope='window',
                                  window=win_id)
        mode_manager.entered.connect(self.on_mode_entered)
        mode_manager.left.connect(self.on_mode_left)
        objreg.get('config').changed.connect(self._set_bg_color)
Ejemplo n.º 5
0
 def __updateChildren(self, sstyle):
     """
     Private slot to change the style of the show UI.
     
     @param sstyle name of the selected style (string)
     """
     QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
     qstyle = QStyleFactory.create(sstyle)
     self.mainWidget.setStyle(qstyle)
     
     lst = self.mainWidget.findChildren(QWidget)
     for obj in lst:
         try:
             obj.setStyle(qstyle)
         except AttributeError:
             pass
     del lst
     
     self.mainWidget.hide()
     self.mainWidget.show()
     
     self.lastQStyle = qstyle
     self.lastStyle = sstyle
     Preferences.Prefs.settings.setValue(
         'UIPreviewer/style', self.styleCombo.currentIndex())
     QApplication.restoreOverrideCursor()
Ejemplo n.º 6
0
    def __init__(self, *args):
        QApplication.__init__(self, *args)

        # Setup appication
        self.setApplicationName('openshot')
        self.setApplicationVersion(info.SETUP['version'])
        # self.setWindowIcon(QIcon("xdg/openshot.svg"))

        # Init settings
        self.settings = settings.SettingStore()
        try:
            self.settings.load()
        except Exception as ex:
            log.error("Couldn't load user settings. Exiting.\n{}".format(ex))
            exit()

        # Init translation system
        language.init_language()

        # Tests of project data loading/saving
        self.project = project_data.ProjectDataStore()

        # Init Update Manager
        self.updates = updates.UpdateManager()

        # It is important that the project is the first listener if the key gets update
        self.updates.add_listener(self.project)

        # Load ui theme if not set by OS
        ui_util.load_theme()

        # Track which dockable window received a context menu
        self.context_menu_object = None

        # Set Experimental Dark Theme
        if self.settings.get("theme") == "Humanity: Dark":
            # Only set if dark theme selected
            self.setStyle(QStyleFactory.create("Fusion"))

            darkPalette = self.palette()
            darkPalette.setColor(QPalette.Window, QColor(53, 53, 53))
            darkPalette.setColor(QPalette.WindowText, Qt.white)
            darkPalette.setColor(QPalette.Base, QColor(25, 25, 25))
            darkPalette.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
            darkPalette.setColor(QPalette.ToolTipBase, Qt.white)
            darkPalette.setColor(QPalette.ToolTipText, Qt.white)
            darkPalette.setColor(QPalette.Text, Qt.white)
            darkPalette.setColor(QPalette.Button, QColor(53, 53, 53))
            darkPalette.setColor(QPalette.ButtonText, Qt.white)
            darkPalette.setColor(QPalette.BrightText, Qt.red)
            darkPalette.setColor(QPalette.Link, QColor(42, 130, 218))
            darkPalette.setColor(QPalette.Highlight, QColor(42, 130, 218))
            darkPalette.setColor(QPalette.HighlightedText, Qt.black)
            self.setPalette(darkPalette)
            self.setStyleSheet("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }")

        # Create main window
        from windows.main_window import MainWindow
        self.window = MainWindow()
        self.window.show()
Ejemplo n.º 7
0
def nfontEditGUIStart():
    app = QApplication(sys.argv)
    ex = NFontEditWidget('__main__')
    QApplication.setStyle(QStyleFactory.create('Fusion'))
    ex.openFile()
    ex.show()
    sys.exit(app.exec_())
Ejemplo n.º 8
0
    def styleChanged(self, styleName):
        style = QStyleFactory.create(styleName)
        if style:
            self.setStyleHelper(self, style)

        # Keep a reference to the style.
        self._style = style
Ejemplo n.º 9
0
    def __init__(self, *, win_id, tab_id, tab, private, parent=None):
        super().__init__(parent)
        if utils.is_mac:
            # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-42948
            # See https://github.com/qutebrowser/qutebrowser/issues/462
            self.setStyle(QStyleFactory.create('Fusion'))
        # FIXME:qtwebengine this is only used to set the zoom factor from
        # the QWebPage - we should get rid of it somehow (signals?)
        self.tab = tab
        self._tabdata = tab.data
        self.win_id = win_id
        self.scroll_pos = (-1, -1)
        self._old_scroll_pos = (-1, -1)
        self._set_bg_color()
        self._tab_id = tab_id

        page = webpage.BrowserPage(win_id=self.win_id, tab_id=self._tab_id,
                                   tabdata=tab.data, private=private,
                                   parent=self)
        page.setVisibilityState(
            QWebPage.VisibilityStateVisible if self.isVisible()
            else QWebPage.VisibilityStateHidden)

        self.setPage(page)

        config.instance.changed.connect(self._set_bg_color)
Ejemplo n.º 10
0
    def __init__(self, win_id, parent=None):
        super().__init__(parent)
        self.pattern = ''
        self._win_id = win_id
        config.instance.changed.connect(self._on_config_changed)

        self._active = False

        self._delegate = completiondelegate.CompletionItemDelegate(self)
        self.setItemDelegate(self._delegate)
        self.setStyle(QStyleFactory.create('Fusion'))
        config.set_register_stylesheet(self)
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.setHeaderHidden(True)
        self.setAlternatingRowColors(True)
        self.setIndentation(0)
        self.setItemsExpandable(False)
        self.setExpandsOnDoubleClick(False)
        self.setAnimated(False)
        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        # WORKAROUND
        # This is a workaround for weird race conditions with invalid
        # item indexes leading to segfaults in Qt.
        #
        # Some background: http://bugs.quassel-irc.org/issues/663
        # The proposed fix there was later reverted because it didn't help.
        self.setUniformRowHeights(True)
        self.hide()
Ejemplo n.º 11
0
    def __init__(self, win_id, tab_id, tab, parent=None):
        super().__init__(parent)
        if sys.platform == 'darwin' and qtutils.version_check('5.4'):
            # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-42948
            # See https://github.com/The-Compiler/qutebrowser/issues/462
            self.setStyle(QStyleFactory.create('Fusion'))
        self.tab = tab
        self.win_id = win_id
        self._check_insertmode = False
        self.scroll_pos = (-1, -1)
        self._old_scroll_pos = (-1, -1)
        self._ignore_wheel_event = False
        self._set_bg_color()
        self._tab_id = tab_id

        page = self._init_page()
        hintmanager = hints.HintManager(win_id, self._tab_id, self)
        hintmanager.mouse_event.connect(self.on_mouse_event)
        hintmanager.start_hinting.connect(page.on_start_hinting)
        hintmanager.stop_hinting.connect(page.on_stop_hinting)
        objreg.register('hintmanager', hintmanager, scope='tab', window=win_id,
                        tab=tab_id)
        mode_manager = objreg.get('mode-manager', scope='window',
                                  window=win_id)
        mode_manager.entered.connect(self.on_mode_entered)
        mode_manager.left.connect(self.on_mode_left)
        if config.get('input', 'rocker-gestures'):
            self.setContextMenuPolicy(Qt.PreventContextMenu)
        objreg.get('config').changed.connect(self.on_config_changed)
Ejemplo n.º 12
0
def setStyle():
    global _system_default

    style = QSettings().value("guistyle", "", str).lower()
    if style not in keys():
        style = _system_default
    if style != app.qApp.style().objectName():
        app.qApp.setStyle(QStyleFactory.create(style))
Ejemplo n.º 13
0
def main():
	app = QApplication(sys.argv)
	app.setStyle(QStyleFactory.create("Fusion"))
	main =  QMainWindow()
	ui = Ui_MainWindow()
	ui.setupUi(main)

	main.show()
	sys.exit(app.exec_())
Ejemplo n.º 14
0
def setFusionTheme(myQApplication):
    myQApplication.setStyle(QStyleFactory.create("Fusion"))
    p = myQApplication.palette()
    p.setColor(QPalette.Window, QColor(52, 73, 94))
    p.setColor(QPalette.Button, QColor(52, 73, 94))
    p.setColor(QPalette.Highlight, QColor(0, 0, 255))
    p.setColor(QPalette.ButtonText, QColor(255, 255, 255))
    p.setColor(QPalette.WindowText, QColor(255, 255, 255))
    myQApplication.setPalette(p)
Ejemplo n.º 15
0
 def __init__(self, win_id, parent=None):
     super().__init__(parent)
     if sys.platform == 'darwin' and qtutils.version_check('5.4'):
         # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-42948
         # See https://github.com/The-Compiler/qutebrowser/issues/462
         self.setStyle(QStyleFactory.create('Fusion'))
     self.win_id = win_id
     self.load_status = LoadStatus.none
     self._check_insertmode = False
     self.inspector = None
     self.scroll_pos = (-1, -1)
     self.statusbar_message = ''
     self._old_scroll_pos = (-1, -1)
     self._zoom = None
     self._has_ssl_errors = False
     self._ignore_wheel_event = False
     self.keep_icon = False
     self.search_text = None
     self.search_flags = 0
     self.selection_enabled = False
     self.init_neighborlist()
     self._set_bg_color()
     cfg = objreg.get('config')
     cfg.changed.connect(self.init_neighborlist)
     # For some reason, this signal doesn't get disconnected automatically
     # when the WebView is destroyed on older PyQt versions.
     # See https://github.com/The-Compiler/qutebrowser/issues/390
     self.destroyed.connect(functools.partial(
         cfg.changed.disconnect, self.init_neighborlist))
     self._cur_url = None
     self.cur_url = QUrl()
     self.progress = 0
     self.registry = objreg.ObjectRegistry()
     self.tab_id = next(tab_id_gen)
     tab_registry = objreg.get('tab-registry', scope='window',
                               window=win_id)
     tab_registry[self.tab_id] = self
     objreg.register('webview', self, registry=self.registry)
     page = self._init_page()
     hintmanager = hints.HintManager(win_id, self.tab_id, self)
     hintmanager.mouse_event.connect(self.on_mouse_event)
     hintmanager.start_hinting.connect(page.on_start_hinting)
     hintmanager.stop_hinting.connect(page.on_stop_hinting)
     objreg.register('hintmanager', hintmanager, registry=self.registry)
     mode_manager = objreg.get('mode-manager', scope='window',
                               window=win_id)
     mode_manager.entered.connect(self.on_mode_entered)
     mode_manager.left.connect(self.on_mode_left)
     self.viewing_source = False
     self.setZoomFactor(float(config.get('ui', 'default-zoom')) / 100)
     self._default_zoom_changed = False
     if config.get('input', 'rocker-gestures'):
         self.setContextMenuPolicy(Qt.PreventContextMenu)
     self.urlChanged.connect(self.on_url_changed)
     self.loadProgress.connect(lambda p: setattr(self, 'progress', p))
     objreg.get('config').changed.connect(self.on_config_changed)
Ejemplo n.º 16
0
    def checkCurrentStyle(self):
        for action in self.styleActionGroup.actions():
            styleName = action.data()
            candidate = QStyleFactory.create(styleName)

            if candidate is None:
                return

            if candidate.metaObject().className() == QApplication.style().metaObject().className():
                action.trigger()
Ejemplo n.º 17
0
    def __init__(self, parent=None):
        super(Example, self).__init__(parent)
        QApplication.setStyle(QStyleFactory.create('Fusion'))

        # -------------- QCOMBOBOX ----------------------
        cbx = QComboBox()
        # agregar lista de nombres de estilos disponibles
        cbx.addItems(QStyleFactory.keys())
        # responder al evento cambio de texto
        cbx.currentTextChanged.connect(self.textChanged)
        # seleccionar el ultimo elemento
        cbx.setItemText(4, 'Fusion')

        # -------------- QLISTWIDGET ---------------------
        items = ['Ubuntu', 'Linux', 'Mac OS', 'Windows', 'Fedora', 'Chrome OS', 'Android', 'Windows Phone']

        self.lv = QListWidget()
        self.lv.addItems(items)
        self.lv.itemSelectionChanged.connect(self.itemChanged)

        # -------------- QTABLEWIDGET --------------------
        self.table = QTableWidget(10, 3)
        # establecer nombre de cabecera de las columnas
        self.table.setHorizontalHeaderLabels(['Nombre', 'Edad', 'Nacionalidad'])
        # evento producido cuando cambia el elemento seleccionado
        self.table.itemSelectionChanged.connect(self.tableItemChanged)
        # alternar color de fila
        self.table.setAlternatingRowColors(True)
        # seleccionar solo filas
        self.table.setSelectionBehavior(QTableWidget.SelectRows)
        # usar seleccion simple, una fila a la vez
        self.table.setSelectionMode(QTableWidget.SingleSelection)

        table_data = [
            ("Alice", 15, "Panama"),
            ("Dana", 25, "Chile"),
            ("Fernada", 18, "Ecuador")
        ]

        # agregar cada uno de los elementos al QTableWidget
        for i, (name, age, city) in enumerate(table_data):
            self.table.setItem(i, 0, QTableWidgetItem(name))
            self.table.setItem(i, 1, QTableWidgetItem(str(age)))
            self.table.setItem(i, 2, QTableWidgetItem(city))

        vbx = QVBoxLayout()
        vbx.addWidget(QPushButton('Tutoriales PyQT-5'))
        vbx.setAlignment(Qt.AlignTop)
        vbx.addWidget(cbx)
        vbx.addWidget(self.lv)
        vbx.addWidget(self.table)

        self.setWindowTitle("Items View")
        self.resize(362, 320)
        self.setLayout(vbx)
Ejemplo n.º 18
0
def main():
    app = QApplication(sys.argv)
    app.setStyle(QStyleFactory.create("Fusion"))
    main = Window()
    main.resize(950, 600)
    main.setWindowTitle(APP_NAME)
    main.show()
    try:
        sys.exit(app.exec_())
    except KeyboardInterrupt:
        pass
Ejemplo n.º 19
0
def apply_style(style_name):
    if style_name == 'LiSP':
        qApp.setStyleSheet(QLiSPTheme)

        # Change link color
        palette = qApp.palette()
        palette.setColor(QPalette.Link, QColor(65, 155, 230))
        palette.setColor(QPalette.LinkVisited, QColor(43, 103, 153))
        qApp.setPalette(palette)
    else:
        qApp.setStyleSheet('')
        qApp.setStyle(QStyleFactory.create(style_name))
Ejemplo n.º 20
0
    def __init__(self):
        """Initialize all functions we're not overriding.

        This simply calls the corresponding function in self._style.
        """
        self._style = QStyleFactory.create('Fusion')
        for method in ['drawComplexControl', 'drawItemPixmap',
                       'generatedIconPixmap', 'hitTestComplexControl',
                       'itemPixmapRect', 'itemTextRect', 'polish', 'styleHint',
                       'subControlRect', 'unpolish', 'drawItemText',
                       'sizeFromContents', 'drawPrimitive']:
            target = getattr(self._style, method)
            setattr(self, method, functools.partial(target))
        super().__init__()
Ejemplo n.º 21
0
    def __init__(self, dataBack):
        QtCore.QObject.__init__(self) # Without this, the PyQt wrapper is created but the C++ object is not!!!
        from PyQt5.QtWidgets import QApplication, QMainWindow, QStyleFactory
        import sys
        app = QApplication(sys.argv)
        app.setStyle(QStyleFactory.create("Fusion"))
        self.mainWindow = uic.loadUi('canaconda_mainwindow.ui')

        self.enableButtonsSig.connect(self.enableButtons)
        self.dataBack = dataBack
        self.insertWidgets()

        self.mainWindow.show()
        sys.exit(app.exec_())
Ejemplo n.º 22
0
 def setStyle(self, styleName, styleSheetFile):
     """
     Public method to set the style of the interface.
     
     @param styleName name of the style to set (string)
     @param styleSheetFile name of a style sheet file to read to overwrite
         defaults of the given style (string)
     """
     # step 1: set the style
     style = None
     if styleName != "System" and styleName in QStyleFactory.keys():
         style = QStyleFactory.create(styleName)
     if style is None:
         style = QStyleFactory.create(self.defaultStyleName)
     if style is not None:
         QApplication.setStyle(style)
     
     # step 2: set a style sheet
     if styleSheetFile:
         try:
             f = open(styleSheetFile, "r", encoding="utf-8")
             styleSheet = f.read()
             f.close()
         except (IOError, OSError) as msg:
             E5MessageBox.warning(
                 self,
                 self.tr("Loading Style Sheet"),
                 self.tr(
                     """<p>The Qt Style Sheet file <b>{0}</b> could"""
                     """ not be read.<br>Reason: {1}</p>""")
                 .format(styleSheetFile, str(msg)))
             return
     else:
         styleSheet = ""
     
     e5App().setStyleSheet(styleSheet)
Ejemplo n.º 23
0
    def __init__(self,mainwin):
     super(AssetWidget, self).__init__()
     self.mainwin = mainwin
     mainLayout = QVBoxLayout()

     viewBase = View("<BASE>",basedir)
     viewData = View("<DATA>",datadir)
     viewSrc = View("<SRC>",srcdir)
     viewDst = View("<DST>",dstdir)
     viewBase.addToLayout(mainLayout)
     viewData.addToLayout(mainLayout)
     viewSrc.addToLayout(mainLayout)
     viewDst.addToLayout(mainLayout)

     sbutton = QPushButton()
     style = QStyleFactory.create("Macintosh")
     icon = style.standardIcon(QStyle.SP_FileIcon)
     sbutton.setIcon(icon)
     #sbutton.setStyleSheet("background-color: rgb(0, 0, 64); border-radius: 2; ")
     sbutton.pressed.connect(self.selectInput)

     self.srced = Edit("Source File")
     slay2 = QHBoxLayout()
     slay2.addLayout(self.srced.layout)
     self.srced.edit.setStyleSheet(bgcolor(128,32,128)+fgcolor(0,255,0))
     slay2.addWidget(sbutton)
     mainLayout.addLayout(slay2)

     ad_lo = QHBoxLayout()
     self.assettypeview = View("AssetType","???")
     self.assettypeview.addToLayout(ad_lo)
     self.assettypeview.layout.setStretchFactor(self.assettypeview.labl,1)
     self.assettypeview.layout.setStretchFactor(self.assettypeview.edit,3)

     self.dsted = View("Dest File","");
     self.dsted.addToLayout(ad_lo)
     self.dsted.layout.setStretchFactor(self.dsted.edit,8)
     self.dsted.layout.setStretchFactor(self.dsted.labl,1)
     ad_lo.setStretchFactor(self.assettypeview.layout,1)
     ad_lo.setStretchFactor(self.dsted.layout,3)

     mainLayout.addLayout(ad_lo)

     gobutton = QPushButton("Go")
     gobutton.setStyleSheet(bgcolor(32,32,128)+fgcolor(255,255,128))
     mainLayout.addWidget(gobutton)
     gobutton.pressed.connect(self.goPushed)
     self.setLayout(mainLayout)
Ejemplo n.º 24
0
    def initUI(self):
        hbox = QHBoxLayout(self)
        topleft = QFrame()
        topleft.setFrameShape(QFrame.StyledPanel)

        bottom = QFrame()
        bottom.setFrameShape(QFrame.StyledPanel)
        splitter1 = QSplitter(Qt.Horizontal)
        self.compmodel = models.Components(self.connection)
        self._setlayoutTopleft(topleft)
        splitter1.addWidget(topleft)
        splitter1.addWidget(self.cnview.getView())
        splitter1.setSizes([100, 200])

        splitter2 = QSplitter(Qt.Vertical)
        splitter2.addWidget(splitter1)
        splitter2.addWidget(bottom)
        hbox.addWidget(splitter2)
        self.setLayout(hbox)
        QApplication.setStyle(QStyleFactory.create('Cleanlooks'))
Ejemplo n.º 25
0
 def __init__(self, model, parent=None):
     super().__init__(parent)
     if not utils.is_mac:
         self.setStyle(QStyleFactory.create('Fusion'))
     stylesheet.set_register(self)
     self.setResizeMode(QListView.Adjust)
     self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
     self.setFocusPolicy(Qt.NoFocus)
     self.setFlow(QListView.LeftToRight)
     self.setSpacing(1)
     self._menu = None
     model.rowsInserted.connect(functools.partial(update_geometry, self))
     model.rowsRemoved.connect(functools.partial(update_geometry, self))
     model.dataChanged.connect(functools.partial(update_geometry, self))
     self.setModel(model)
     self.setWrapping(True)
     self.setContextMenuPolicy(Qt.CustomContextMenu)
     self.customContextMenuRequested.connect(self.show_context_menu)
     self.clicked.connect(self.on_clicked)
Ejemplo n.º 26
0
 def __init__(self, parent=None):
     super(DatamoshDialog, self).__init__(parent)
     QApplication.setStyle(QStyleFactory.create('windows'))
     self.setWindowTitle(APP_NAME)
     self._createInputGroupBox()
     self.main_button = QPushButton('COMMENCE MOSH')
     self.about_button = QPushButton('ABOUT MOSHUA')
     self.main_button.show()
     self.main_button.clicked.connect(self._on_datamosh_clicked)
     self.about_button.show()
     self.about_button.clicked.connect(self._on_about_clicked)
     self.logGui = LogGui(
     )  # Custom Text 'EDIT' for directing yaspin output
     mainLayout = QGridLayout()
     self.setLayout(mainLayout)
     mainLayout.addWidget(self.inputGroupBox, 0, 0, 1, 2)  #, 2, 1)
     mainLayout.addWidget(self.main_button, 1, 1, 1, 1)
     mainLayout.addWidget(self.about_button, 1, 0, 1, 1)
     mainLayout.addWidget(self.logGui, 2, 0, 1, 0)  # 2010
     self.output_dir = 'moshed_videos'
Ejemplo n.º 27
0
 def __init__(self, win_id, parent=None):
     super().__init__(parent)
     self.setStyle(QStyleFactory.create('Fusion'))
     style.set_register_stylesheet(self)
     self.setResizeMode(QListView.Adjust)
     self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
     self.setFocusPolicy(Qt.NoFocus)
     self.setFlow(QListView.LeftToRight)
     self.setSpacing(1)
     self._menu = None
     model = objreg.get('download-model', scope='window', window=win_id)
     model.rowsInserted.connect(functools.partial(update_geometry, self))
     model.rowsRemoved.connect(functools.partial(update_geometry, self))
     model.dataChanged.connect(functools.partial(update_geometry, self))
     self.setModel(model)
     self.setWrapping(True)
     self.setContextMenuPolicy(Qt.CustomContextMenu)
     self.customContextMenuRequested.connect(self.show_context_menu)
     self.clicked.connect(self.on_clicked)
Ejemplo n.º 28
0
 def __init__(self, parent=None):
     super(QxtSpanSlider, self).__init__(Qt.Horizontal, parent)
     self.setStyle(QStyleFactory.create('Plastique'))
     self.lower = 0
     self.upper = 0
     self.lowerPos = 0
     self.upperPos = 0
     self.offset = 0
     self.position = 0
     self.lastPressed = QxtSpanSlider.NoHandle
     self.upperPressed = QStyle.SC_None
     self.lowerPressed = QStyle.SC_None
     self.movement = QxtSpanSlider.FreeMovement
     self.mainControl = QxtSpanSlider.LowerHandle
     self.firstMovement = False
     self.blockTracking = False
     self.gradientLeft = self.palette().color(QPalette.Dark).lighter(110)
     self.gradientRight = self.palette().color(QPalette.Dark).lighter(110)
     self.rangeChanged.connect(self.updateRange)
     self.sliderReleased.connect(self.movePressedHandle)
Ejemplo n.º 29
0
 def __init__(self,
              service: VideoService,
              parent=None,
              flags=Qt.WindowCloseButtonHint):
     super(SettingsDialog, self).__init__(parent.parent, flags)
     self.parent = parent
     self.service = service
     self.settings = self.parent.settings
     self.theme = self.parent.theme
     self.setObjectName('settingsdialog')
     if sys.platform == 'win32':
         self.setStyle(QStyleFactory.create('Fusion'))
     self.setWindowTitle('Settings')
     self.categories = QListWidget(self)
     self.categories.setResizeMode(QListView.Fixed)
     self.categories.setStyleSheet(
         'QListView::item { text-decoration: none; }')
     self.categories.setAttribute(Qt.WA_MacShowFocusRect, False)
     self.categories.setObjectName('settingsmenu')
     self.categories.setUniformItemSizes(True)
     self.categories.setMouseTracking(True)
     self.categories.setViewMode(QListView.IconMode)
     self.categories.setIconSize(QSize(90, 60))
     self.categories.setMovement(QListView.Static)
     self.categories.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     self.pages = QStackedWidget(self)
     self.pages.addWidget(GeneralPage(self))
     self.pages.addWidget(VideoPage(self))
     self.pages.addWidget(ThemePage(self))
     self.pages.addWidget(ToolsPage(self))
     self.pages.addWidget(LogsPage(self))
     self.initCategories()
     horizontalLayout = QHBoxLayout()
     horizontalLayout.addWidget(self.categories)
     horizontalLayout.addWidget(self.pages, 1)
     buttons = QDialogButtonBox(QDialogButtonBox.Ok, self)
     buttons.accepted.connect(self.close)
     mainLayout = QVBoxLayout()
     mainLayout.addLayout(horizontalLayout)
     mainLayout.addWidget(buttons)
     self.setLayout(mainLayout)
Ejemplo n.º 30
0
def main():
    """Run StarCraft Casting Tool."""
    from scctool.view.main import MainWindow
    from PyQt5.QtCore import QSize
    from PyQt5.QtGui import QIcon

    translator = None

    currentExitCode = MainWindow.EXIT_CODE_REBOOT
    while currentExitCode == MainWindow.EXIT_CODE_REBOOT:
        try:
            scctool.settings.loadSettings()
            app = QApplication(sys.argv)
            app.setStyle(QStyleFactory.create('Fusion'))
            translator = choose_language(app, translator)

            icon = QIcon()
            icon.addFile(scctool.settings.getResFile(
                'scct.ico'), QSize(32, 32))
            app.setWindowIcon(icon)

            showChangelog, updater = initial_download()
            if updater:
                scctool.settings.loadSettings()
            main_window(app, showChangelog)
            currentExitCode = app.exec_()
            app = None
        except Exception as e:
            logger.exception("message")
            message = _(
                'Critical error <i>`{error}`</i>! Please provide the log-file'
                ' to the developer of StarCraft Casting Tool. '
                '<a href="{link}">{link}</a>')
            QMessageBox.critical(
                None, _('Critical Error'),
                message.format(
                    error=e, link='https://discord.gg/G9hFEfh'),
                QMessageBox.Ok)
            break

    sys.exit(currentExitCode)
Ejemplo n.º 31
0
def main():
    parser = argparse.ArgumentParser(description="Plom management tasks.")
    parser.add_argument("--version",
                        action="version",
                        version="%(prog)s " + __version__)
    parser.add_argument("-w",
                        "--password",
                        type=str,
                        help='for the "manager" user')
    parser.add_argument(
        "-s",
        "--server",
        metavar="SERVER[:PORT]",
        action="store",
        help="Which server to contact, port defaults to {}.".format(
            Default_Port),
    )
    args = parser.parse_args()

    app = QApplication(sys.argv)
    app.setStyle(QStyleFactory.create("Fusion"))

    signal.signal(signal.SIGINT, sigint_handler)

    # create a small timer here, so that we can
    # kill the app with ctrl-c.
    timer = QTimer()
    timer.timeout.connect(lambda: None)
    timer.start(1000)
    # got this solution from
    # https://machinekoder.com/how-to-not-shoot-yourself-in-the-foot-using-python-qt/

    window = Manager(app)
    window.show()

    window.ui.userLE.setText("manager")
    window.ui.passwordLE.setText(args.password)
    if args.server:
        window.setServer(args.server)

    sys.exit(app.exec_())
Ejemplo n.º 32
0
    def send_mes(self):
        # Check to see if connection is established
        if self.connected:
            # Send user message to chat window
            self.chat_text.insertHtml("<b>Me: </b>" + self.message_term.text())
            self.chat_text.insertPlainText("\n")

            # Send message across client
            self.socket.sendall(
                ("<b>Person: </b>" + self.message_term.text()).encode())

            # Clear message terminal
            self.message_term.setText("")
        else:
            bad_connect = QMessageBox()
            bad_connect.setText("Please first establish a connection")
            bad_connect.setStyle(QStyleFactory.create("Fusion"))
            bad_connect.setStyleSheet(
                "font:bold; color: rgb(153, 170, 181); background-color: rgb(44, 47, 51); font-size: 12px"
            )
            bad_connect.exec()
Ejemplo n.º 33
0
 def __init__(self, parent=None):
     super(VCTimeCounter, self).__init__(parent)
     self.parent = parent
     self.timeedit = QTimeEdit(QTime(0, 0))
     self.timeedit.setObjectName('timeCounter')
     self.timeedit.setStyle(QStyleFactory.create('Fusion'))
     self.timeedit.setFrame(False)
     self.timeedit.setDisplayFormat('hh:mm:ss.zzz')
     self.timeedit.timeChanged.connect(self.timeChangeHandler)
     self.timeedit.setCurrentSectionIndex(3)
     separator = QLabel('/')
     separator.setObjectName('timeSeparator')
     self.duration = QLabel('00:00:00.000')
     self.duration.setObjectName('timeDuration')
     layout = QHBoxLayout()
     layout.setContentsMargins(0, 0, 0, 0)
     layout.setSpacing(5)
     layout.addWidget(self.timeedit)
     layout.addWidget(separator)
     layout.addWidget(self.duration)
     self.setLayout(layout)
Ejemplo n.º 34
0
def main():
    """
    App entry point.
    """
    from matplotlib import rcParams
    rcParams.update({'figure.autolayout': True})

    QApplication.setStyle(QStyleFactory.create('Fusion'))
    app = QApplication(sys.argv)

    rect = QDesktopWidget().screenGeometry(-1)
    width = 1400
    height = 1000
    if rect.width() > 1920 and rect.height() > 1080:
        app.font().setPointSize(16)
        app.setFont(app.font())
        width, height = (1650, 1080)

    window = MainWindow(width, height)
    window.show()
    sys.exit(app.exec_())
Ejemplo n.º 35
0
    def __init__(self, parent=None):
        super(DataMigrationTool, self).__init__(parent)
        QApplication.setStyle(QStyleFactory.create('Fusion'))
        #print(QStyleFactory.keys())
        self.sourcePath = ""
        self.destinationPath = ""

        self.sourceLbl = None
        self.destinationLbL = None
        self.output = None

        self.createTopGroup()
        self.createBottomGroup()

        mainLayout = QGridLayout()
        mainLayout.addWidget(self.topGroupBox, 1, 0)
        mainLayout.addWidget(self.bottomGroupBox, 2, 0)
        self.setLayout(mainLayout)

        self.setWindowTitle("Data Migration Tool")
        self.setGeometry(1000, 100, 1000, 800)
Ejemplo n.º 36
0
    def __init__(self, win_id, tab_id, tab, parent=None):
        super().__init__(parent)
        if sys.platform == 'darwin' and qtutils.version_check('5.4'):
            # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-42948
            # See https://github.com/The-Compiler/qutebrowser/issues/462
            self.setStyle(QStyleFactory.create('Fusion'))
        # FIXME:qtwebengine this is only used to set the zoom factor from
        # the QWebPage - we should get rid of it somehow (signals?)
        self.tab = tab
        self.win_id = win_id
        self.scroll_pos = (-1, -1)
        self._old_scroll_pos = (-1, -1)
        self._set_bg_color()
        self._tab_id = tab_id

        self._init_page(tab.data)
        mode_manager = objreg.get('mode-manager', scope='window',
                                  window=win_id)
        mode_manager.entered.connect(self.on_mode_entered)
        mode_manager.left.connect(self.on_mode_left)
        objreg.get('config').changed.connect(self._set_bg_color)
Ejemplo n.º 37
0
    def __init__(self, parser=None, msd=None, parent=None):
        super(FunctionOptimizer, self).__init__(parent)
        self.setWindowTitle("Metody optymalizacji")
        QApplication.setStyle(QStyleFactory.create('windows'))

        self.parser = parser
        self.msd = msd

        self.create_parser_box()
        self.create_plot_box()
        self.create_function_info()

        main_layout = QGridLayout()
        fig = plt.figure(dpi=140)

        self.fig_canvas = Plot3D(fig)
        main_layout.addWidget(self.fig_canvas, 0, 0, 3, 1)
        main_layout.addWidget(self.parser_group_box, 0, 1)
        main_layout.addWidget(self.plot_group_box, 1, 1)
        main_layout.addWidget(self.info_group_box, 2, 1)
        self.setLayout(main_layout)
Ejemplo n.º 38
0
 def __init__(self, parent):
     super(waitingDialog, self).__init__(parent=parent)
     self.resize(200, 200)
     self.setWindowFlags(Qt.ToolTip)
     palette = QPalette()
     palette.setColor(QPalette.Background, Qt.white)
     self.setPalette(palette)
     movie = QMovie("./image/waiting.gif")
     label = QLabel()
     label.setAlignment(Qt.AlignCenter)
     label.setMovie(movie)
     self.progress = QProgressBar()
     self.progress.setRange(0, 1000)
     self.progress.setValue(1000)
     self.progress.setStyle(QStyleFactory.create('Fusion'))
     movie.start()
     box = QVBoxLayout()
     box.addWidget(label)
     box.addWidget(self.progress)
     self.setLayout(box)
     self.setWindowOpacity(0.85)
Ejemplo n.º 39
0
def main():
    cache_size_in_kb = 700 * 10**3
    QPixmapCache.setCacheLimit(cache_size_in_kb)  # 将缓存设置为700000千字节(684Mb左右)

    app = QApplication(sys.argv)

    # setup_app_form = QSplashScreen(QPixmap(":/ApplicationLoadImg2.png").scaled(800, 500))
    # setup_app_form.show()
    # setup_app_form.showMessage("正在努力加载数据...", Qt.AlignHCenter | Qt.AlignBottom, Qt.darkYellow)
    # time.sleep(12.)

    app.setOrganizationName("LRSM Ltd.")
    app.setOrganizationDomain("lrsm.eu")
    app.setApplicationName("LRSMSingleVersion")
    app.setStyle(QStyleFactory.create(QStyleFactory.keys()[-1]))

    form = MainWindow()
    form.showMaximized()

    # setup_app_form.finish(form)
    sys.exit(app.exec_())
Ejemplo n.º 40
0
def hsiPlot(X):
    """Hyperspectral data viewer

    Displays the hyperspectral data. This is one of two methods to do this.

    Parameters
    ----------
    X : object, Process instance
        The object X containing the hyperspectral array.

    """
    app = QApplication(sys.argv)

    # Setting the dark-themed Fusion style for the GUI
    app.setStyle(QStyleFactory.create('Fusion'))
    dark_palette = QPalette()
    dark_palette.setColor(QPalette.Window, QColor(23, 23, 23))
    dark_palette.setColor(QPalette.WindowText, QColor(200, 200, 200))
    dark_palette.setColor(QPalette.Base, QColor(18, 18, 18))
    dark_palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
    dark_palette.setColor(QPalette.ToolTipBase, Qt.white)
    dark_palette.setColor(QPalette.ToolTipText, Qt.white)
    dark_palette.setColor(QPalette.Text, QColor(200, 200, 200))
    dark_palette.setColor(QPalette.Button, QColor(33, 33, 33))
    dark_palette.setColor(QPalette.ButtonText, QColor(200, 200, 200))
    dark_palette.setColor(QPalette.BrightText, Qt.red)
    dark_palette.setColor(QPalette.Link, QColor(42, 130, 218))
    dark_palette.setColor(QPalette.Highlight, QColor(42, 130, 218))
    dark_palette.setColor(QPalette.HighlightedText, Qt.white)
    dark_palette.setColor(QPalette.Active, QPalette.Button, QColor(33, 33, 33))
    dark_palette.setColor(QPalette.Disabled, QPalette.Button,
                          QColor(20, 20, 20))
    dark_palette.setColor(QPalette.Disabled, QPalette.ButtonText,
                          QColor(120, 120, 120))

    app.setPalette(dark_palette)

    form = HSIDialog(X)
    form.show()
    app.exec_()
Ejemplo n.º 41
0
    def initUI(self):

        self.label_user = QLabel()
        self.label_user.setText("用户名:")
        self.lineEdit_user = QLineEdit()

        self.label_password = QLabel()
        self.label_password.setText("密码:  ")
        self.lineEdit_password = QLineEdit()

        self.pushButton_signin = QPushButton()
        self.pushButton_signin.setText("登陆")
        self.pushButton_signup = QPushButton()
        self.pushButton_signup.setText("注册")

        self.h_layout_user = QHBoxLayout()
        self.h_layout_password = QHBoxLayout()
        self.h_layout_button = QHBoxLayout()
        self.v_layout_all = QVBoxLayout()

        self.h_layout_user.addWidget(self.label_user)
        self.h_layout_user.addWidget(self.lineEdit_user)

        self.h_layout_password.addWidget(self.label_password)
        self.h_layout_password.addWidget(self.lineEdit_password)

        self.h_layout_button.addWidget(self.pushButton_signin)
        self.h_layout_button.addWidget(self.pushButton_signup)

        self.v_layout_all.addLayout(self.h_layout_user)
        self.v_layout_all.addLayout(self.h_layout_password)
        self.v_layout_all.addLayout(self.h_layout_button)

        self.setLayout(self.v_layout_all)

        self.setWindowTitle("登陆界面")
        QApplication.setStyle(QStyleFactory.create("Fusion"))
        # QApplication.setStyle("Fusion")
        # self.setGeometry()
        self.show()
Ejemplo n.º 42
0
    def __init__(self, parent=None):
        QSlider.__init__(self, QtCore.Qt.Horizontal, parent)
        self.rangeChanged[int, int].connect(self.updateRange)
        self.sliderReleased.connect(self.movePressedHandle)

        self.setStyle(QStyleFactory.create('Plastique'))

        self.lower = 0
        self.upper = 0
        self.lowerPos = 0
        self.upperPos = 0
        self.offset = 0
        self.position = 0
        self.lastPressed = QxtSpanSlider.NoHandle
        self.upperPressed = QStyle.SC_None
        self.lowerPressed = QStyle.SC_None
        self.movement = QxtSpanSlider.FreeMovement
        self.mainControl = QxtSpanSlider.LowerHandle
        self.firstMovement = False
        self.blockTracking = False
        self.gradientLeft = self.palette().color(QPalette.Dark).lighter(110)
        self.gradientRight = self.palette().color(QPalette.Dark).lighter(110)
	def __init__(self, parent=None):
		super(Login, self).__init__(parent)

		self.setStyleSheet("background-color: white;")
		self.setStyle(QStyleFactory.create('Fusion'))
		self.setWindowIcon(QIcon('feather.png'))

		self.setGeometry(0, 0, 650, 409)
		self.labeluser = QLabel("USERNAME:"******"PASSWORD", self)
		self.labelpass.move(250, 160)
		self.password.move(250, 180)
		self.password.setEchoMode(QLineEdit.Password)
		self.buttonLogin = QPushButton('Login', self)
		self.buttonLogin.move(250, 230)

		print(self.username.text())
		self.buttonLogin.clicked.connect(self.handleLogin)
Ejemplo n.º 44
0
    def __init__(self, parent=None):
        super(WidgetGallery, self).__init__(parent)

        self.update = False
        # self.alarmSound = QSound("alarmSound.mp3")

        self.originalPalette = QApplication.palette()
        self.setFixedSize(900, 600)

        titleLabel = QLabel("IoT Security System")
        titleLabel.setFont(QFont("Arial", 16))  # , QFont.Bold

        self.createTopLeftRoom()
        self.createTopRightGroupBox()
        self.createBottomLeftTabWidget()
        self.createBottomRightTabWidget()
        self.createProgressBar()

        topLayout = QHBoxLayout()
        topLayout.addWidget(titleLabel)
        topLayout.addStretch(1)

        mainLayout = QGridLayout()
        mainLayout.addLayout(topLayout, 0, 0, 1, 2)
        mainLayout.addWidget(self.topLeftRoom, 1, 0)
        mainLayout.addWidget(self.topRightGroupBox, 1, 1)
        mainLayout.addWidget(self.bottomLeftTabWidget, 2, 0)
        mainLayout.addWidget(self.bottomRightTabWidget, 2, 1)
        mainLayout.addWidget(self.progressBar, 3, 0, 1, 2)
        mainLayout.setRowStretch(1, 1)
        mainLayout.setRowStretch(2, 1)
        mainLayout.setColumnStretch(0, 1)
        mainLayout.setColumnStretch(1, 1)
        self.setLayout(mainLayout)

        self.setWindowTitle("IoT Sec Sys")
        QApplication.setStyle(QStyleFactory.create('Fusion'))

        self.updateNow()
Ejemplo n.º 45
0
def main():

    try:
        app = QApplication(sys.argv)
        app.setApplicationName('SERVOGLU')
        QApplication.setStyle(QStyleFactory.create('Fusion'))
        myFont = QFont()
        myFont.setBold(False)
        myFont.setPointSize(10)
        QApplication.setFont(myFont)
        controller = Controller()
        controller.window.resize(1000, 500)
        controller.window.showMaximized()
        currentExitCode = app.exec_()
    except Exception as e:
        print(e)
        msg = QMessageBox()
        msg.setIcon(QMessageBox.Critical)
        msg.setText("Error")
        msg.setInformativeText(str(e))
        msg.setWindowTitle("Error")
        msg.exec_()
Ejemplo n.º 46
0
    def Setup(self):
        self.setWindowTitle("Thwacker")
        self.setWindowIcon(QIcon())

        self.setMinimumSize(QSize(750,500))

        #ContentSections
        self.Content = QGroupBox()
        self.ContentLayout = QGridLayout()

        # ToolBar
        ToolsToolBar = QToolBar('Tools')
        self.Tools = self.addToolBar(Qt.LeftToolBarArea,ToolsToolBar)

        #OpenGl
        self.GlViewport = QOpenGLWidget()
        self.GlViewport.initializeGL()
        self.GlViewport.paintGL = self.paintGL
        self.GlViewport.initializeGL = self.initializeGL

        self._glTimer = QBasicTimer()
        self._glTimer.start(1000/60, self)

        self.VMFVerts = []
        self.ReadVmf('./test.vmf')
        
        self.ContentLayout.addWidget(self.GlViewport,0,0)
        gluPerspective(45, self.width()/self.height(), 0.1, 50)

        self.Triangle = self.VMFVerts
        self.Indices = [] ;
        for i in range(len(self.VMFVerts)): self.Indices.append(i)
        

        self.Content.setLayout(self.ContentLayout)
        QApplication.setStyle(QStyleFactory.create('Cleanlooks'))
        self.setCentralWidget(self.Content)
        self.showMaximized()
        self.update()
Ejemplo n.º 47
0
    def __init__(self, parent=None):
        super(WidgetGallery, self).__init__(parent)

        self.originalPalette = QApplication.palette()

        searchTextBox = QLineEdit()

        searchLabel = QLabel("&Search:")
        searchLabel.setBuddy(searchTextBox)
        # Whoosh constructs
        MSID_index_dir = 'TestTDB'
        Searchable = ('msid', 'technical_name', 'description')
        self.MaxResults = 100
        self.Timeout = 0.5
        self.WhooshWrapper = WhooshWrap(
            MSID_index_dir, Searchable, self.MaxResults,
            self.Timeout)  # set up searcher and collector once
        searchTextBox.textChanged[str].connect(
            self.doSearch)  # hook up as-you-type event to query function

        # QT widgets,  layout and style
        self.useStylePaletteCheckBox = QCheckBox(
            "&Use style's standard palette")
        self.useStylePaletteCheckBox.setChecked(True)
        self.useStylePaletteCheckBox.toggled.connect(self.changePalette)
        self.searchResults = QTextEdit()

        topLayout = QHBoxLayout()
        topLayout.addWidget(searchLabel)
        topLayout.addWidget(searchTextBox)

        mainLayout = QGridLayout()
        mainLayout.addLayout(topLayout, 0, 0, 1, 4)
        mainLayout.addWidget(self.searchResults, 1, 0)
        self.setLayout(mainLayout)

        self.setWindowTitle("MSID Live Search")
        QApplication.setStyle(QStyleFactory.create("Fusion"))
        self.changePalette()
Ejemplo n.º 48
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.resize(800, 600)
        self.setWindowTitle('Pocket Chat')

        size_policy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        size_policy.setHorizontalStretch(0)
        size_policy.setVerticalStretch(0)
        size_policy.setHeightForWidth(QSizePolicy().hasHeightForWidth())
        self.setSizePolicy(size_policy)

        chat_icon = QIcon()
        chat_icon.addPixmap(QPixmap("logo.ico"), QIcon.Normal, QIcon.Off)
        self.setWindowIcon(chat_icon)

        self.CenterPanel = CenterPanel(self)
        self.setCentralWidget(self.CenterPanel)

        self.MenuToolBar = MenuToolBar(self)

        set_status_bar(self)
        self.setStyle(QStyleFactory.create('Cleanlooks'))
Ejemplo n.º 49
0
    def __init__(self, win_id, tab_id, tab, parent=None):
        super().__init__(parent)
        if sys.platform == 'darwin' and qtutils.version_check('5.4'):
            # WORKAROUND for https://bugreports.qt.io/browse/QTBUG-42948
            # See https://github.com/The-Compiler/qutebrowser/issues/462
            self.setStyle(QStyleFactory.create('Fusion'))
        # FIXME:qtwebengine this is only used to set the zoom factor from
        # the QWebPage - we should get rid of it somehow (signals?)
        self.tab = tab
        self.win_id = win_id
        self.scroll_pos = (-1, -1)
        self._old_scroll_pos = (-1, -1)
        self._set_bg_color()
        self._tab_id = tab_id

        self._init_page(tab.data)
        mode_manager = objreg.get('mode-manager',
                                  scope='window',
                                  window=win_id)
        mode_manager.entered.connect(self.on_mode_entered)
        mode_manager.left.connect(self.on_mode_left)
        objreg.get('config').changed.connect(self._set_bg_color)
Ejemplo n.º 50
0
    def addressbar(self):

        self.addrborder = QWidget(self)
        hbox = QHBoxLayout(self.addrborder)
        hbox.setSpacing(0)

        self.loader = QWidget(self.addrborder)
        self.address = QLineEdit(self.addrborder)

        fact = QStyleFactory.create("Fusion")
        self.address.setStyle(fact)

        self.btn_undo = QPushButton(self.addrborder)
        self.btn_redo = QPushButton(self.addrborder)
        self.btn_back = QPushButton(self.addrborder)

        self.btn_undo.setText('<')
        self.btn_redo.setText('>')
        self.btn_undo.setFixedSize(28, 25)
        self.btn_redo.setFixedSize(28, 25)
        self.btn_back.setFixedSize(28, 25)
        self.address.setFixedHeight(25)

        self.btn_back.setStyleSheet("background: red")
        self.btn_back.setText('..')
        self.btn_undo.pressed.connect(self.undo_btn_event)
        self.btn_redo.pressed.connect(self.redo_btn_event)
        self.btn_back.pressed.connect(self.back_btn_event)

        #self.address.move(3,3)
        hbox.addWidget(self.btn_undo)
        hbox.addWidget(self.btn_redo)
        hbox.addWidget(self.btn_back)
        hbox.addWidget(self.address)

        self.loader.setStyleSheet("background: rgba(100,20,155,.5)")

        self.address.returnPressed.connect(self.address_key_enter)
Ejemplo n.º 51
0
 def __init__(self, parent=None):
     super(Myset, self).__init__(parent)
     self.setupUi(self)
     # 用来保存时间产生的
     self.setting = QSettings("mysetting.ini", QSettings.IniFormat)
     # 连接所有信号与槽
     self.signalsolt()
     # 读取上次保存的时间参数配置ini
     self.init_setting()
     # 发送的数据
     self.send_data = [
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
         0,
     ]
     self.setStyle(QStyleFactory.create("Fusion"))
Ejemplo n.º 52
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        QApplication.setStyle(QStyleFactory.create('Fusion'))

        self.ui = uic.loadUi("src/ui.ui", self)

        if os.path.exists(Form.RANK_CACHE_FILE_NAME):
            self._univ_rank = pickle.load(open(Form.RANK_CACHE_FILE_NAME,
                                               "rb"))
        else:
            self._univ_rank = UnivRank()
            pickle.dump(self._univ_rank, open(Form.RANK_CACHE_FILE_NAME, "wb"))

        self._init_lineEdit()

        self._filter = Filter()
        self._init_comboBox("country")
        self._init_comboBox("subject")

        self._init_tableWidget()
        self._init_detailTableWidget()

        self._init_displayLengthComboBox()
Ejemplo n.º 53
0
    def __init__(self, app, title: str, assignment_id: int = None):
        super().__init__(app, title, 4)
        self.course = app.planner.get_current_course()
        y, m, d = str(datetime.now().date()).split("-")
        date = QDate(int(y), int(m), int(d))

        # Create Widgets
        self.lineedit_name = QLineEdit()
        self.lineedit_name.textChanged.connect(self.check_text)

        self.dateedit_due = QDateEdit()
        self.dateedit_due.setDate(date)
        self.dateedit_due.setStyle(QStyleFactory.create("Fusion"))

        # Add the Widgets
        self.add_widget("Name", self.lineedit_name)
        self.add_widget("Due Date", self.dateedit_due)

        self.lineedit_name.setFocus()

        self.old_info = None
        if assignment_id is not None:
            self.load_info(assignment_id)
Ejemplo n.º 54
0
    def initUI(self):
        hbox = QHBoxLayout(self)
        topleft = QFrame()
        topleft.setFrameShape(QFrame.StyledPanel)
        bottom = QFrame()
        bottom.setFrameShape(QFrame.StyledPanel)

        splitter1 = QSplitter(Qt.Horizontal)
        textedit = QTextEdit()
        splitter1.addWidget(topleft)
        splitter1.addWidget(textedit)
        splitter1.setSizes([100, 200])

        splitter2 = QSplitter(Qt.Vertical)
        splitter2.addWidget(splitter1)
        splitter2.addWidget(bottom)
        hbox.addWidget(splitter2)

        self.setLayout(hbox)
        QApplication.setStyle(QStyleFactory.create('Cleanlooks'))
        self.setGeometry(300, 300, 300, 200)
        self.setWindowTitle('QSplitter demo')
        self.show()
    def __init__(self):
        # Necessary for building executable with Pyinstaller correctly on Windows
        # (see https://github.com/pyinstaller/pyinstaller/wiki/Recipe-Multiprocessing)
        multiprocessing.freeze_support()

        # Reroute exceptions to display a message box to the user
        sys.excepthook = self.exception_hook

        app = QApplication(sys.argv)
        app.setStyle(QStyleFactory.create('Fusion'))
        app.setWindowIcon(QIcon("../resources/icon.ico"))

        self.signals: Signals = Signals()
        self.signals.processing_progress.connect(self.onProcessingProgress)
        self.signals.processing_completed.connect(self.onProcessingCompleted)
        self.signals.processing_cancelled.connect(self.onProcessingCancelled)
        self.signals.processing_errored.connect(self.onProcessingErrored)

        self.worker: AsyncTask = None
        self.model: Model = Model(self)
        self.view: View = View(self)

        sys.exit(app.exec_())
Ejemplo n.º 56
0
Archivo: new.py Proyecto: walle13/pySmc
    def __init__(self, parent= None):
        QtWidgets.QWidget.__init__(self)

        self.color = QColor(0, 0, 0)
        self.setGeometry(300, 300, 280, 170)
        self.setWindowTitle('ToggleButton')
        self.red = QPushButton('Red',  self)
        self.red.setCheckable(True)
        self.red.move(10, 10)
        self.red.clicked.connect(self.setRed)
        self.green = QPushButton('Green',  self)
        self.green.setCheckable(True)
        self.green.move(10, 60)
        self.green.clicked.connect(self.setGreen)
        self.blue = QPushButton('Blue',  self)
        self.blue.setCheckable(True)
        self.blue.move(10, 110)
        self.blue.clicked.connect(self.setBlue)

        self.square = QtWidgets.QWidget(self)
        self.square.setGeometry(150, 20, 100, 100)
        self.square.setStyleSheet('QWidget{background-color:%s}'%self.color.name())
        QApplication.setStyle(QStyleFactory.create('cleanlooks'))
Ejemplo n.º 57
0
    def createTabWidgetStyle(self):
        self.tabWidgetStyle = QWidget()
        self.tabWidgetStyle.setObjectName("tabWidgetStyle")

        self.verticalLayout = QVBoxLayout(self.tabWidgetStyle)
        self.verticalLayout.setObjectName("verticalLayout")

        self.horizontalLayout = QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")

        self.labelWidgetStyle = QLabel(self.tabWidgetStyle)
        self.labelWidgetStyle.setText(self.tr("Widget Style:"))
        self.labelWidgetStyle.setObjectName("labelWidgetStyle")
        self.horizontalLayout.addWidget(self.labelWidgetStyle)

        self.comboBoxWidgetStyle = QComboBox(self.tabWidgetStyle)
        self.comboBoxWidgetStyle.setObjectName("comboBoxWidgetStyle")
        self.comboBoxWidgetStyle.addItem(self.tr("QtCurve"))
        self.comboBoxWidgetStyle.addItem(self.tr("Breeze"))
        self.comboBoxWidgetStyle.addItem(self.tr("Oxygen"))
        self.comboBoxWidgetStyle.addItem(self.tr("Fusion"))
        self.horizontalLayout.addWidget(self.comboBoxWidgetStyle)

        self.verticalLayout.addLayout(self.horizontalLayout)

        self.verticalLayout.addItem(QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding))


        self.previewWidgetStyle = PreviewWidgetStyle(self.tabWidgetStyle)
        self.previewWidgetStyle.tabWidget.setStyle(QStyleFactory.create("QtCurve"))

        self.verticalLayout.addWidget(self.previewWidgetStyle)


        self.addTab(self.tabWidgetStyle, self.tr("Widget Style"))

        self.comboBoxWidgetStyle.currentTextChanged.connect(self.previewStyle)
Ejemplo n.º 58
0
        recipe = whatsfordinner.getRandomRecipe(all_recipes)

        home.currentRecipe = recipe
        home.title.setText('''<a href='''+recipe.link+'''>'''+recipe.title +'''</a>''')
        home.ingredients.setText(recipe.ingredients)
        home.title.repaint()
        home.ingredients.repaint()

    #Select the recipe that is currently displayed
    #Generate the shopping list, open editGUI with the shopping list
    def select(self):
        if home.currentRecipe == None:
            print("No recipe selected")
        else:
            home.currentRecipe.display()
            print("")
            whatsfordinner.select(home.currentRecipe)
            self.shoppinglistUI = editGUI.Edit("shoppinglist.txt")
            self.shoppinglistUI.show()

    #Close the GUI
    def exit(self):
        self.close()

if __name__ == '__main__':

    app = QApplication(sys.argv)
    app.setStyle(QStyleFactory.create("cleanlooks"))
    home = Home()
    sys.exit(app.exec_())
Ejemplo n.º 59
0
 def changeStyle(self, styleName):
     QApplication.setStyle(QStyleFactory.create(styleName))
     self.changePalette()
Ejemplo n.º 60
0
def main():
    if sys.version_info < (3, 4):
        print("You need at least Python 3.4 for this application!")
        sys.exit(1)

    t = time.time()
    if GENERATE_UI and not hasattr(sys, 'frozen'):
        try:
            urh_dir = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "..", ".."))
            sys.path.append(urh_dir)
            sys.path.append(os.path.join(urh_dir, "src"))

            import generate_ui

            generate_ui.gen()

            print("Time for generating UI: %.2f seconds" % (time.time() - t))
        except (ImportError, FileNotFoundError):
            print("Will not regenerate UI, because script can't be found. This is okay in release.")

    urh_exe = sys.executable if hasattr(sys, 'frozen') else sys.argv[0]
    urh_exe = os.readlink(urh_exe) if os.path.islink(urh_exe) else urh_exe

    urh_dir = os.path.join(os.path.dirname(os.path.realpath(urh_exe)), "..", "..")
    prefix = os.path.abspath(os.path.normpath(urh_dir))

    src_dir = os.path.join(prefix, "src")
    if os.path.exists(src_dir) and not prefix.startswith("/usr") and not re.match(r"(?i)c:\\program", prefix):
        # Started locally, not installed
        print("Adding {0} to pythonpath. This is only important when running URH from source.".format(src_dir))
        sys.path.insert(0, src_dir)

    from urh.util import util
    util.set_windows_lib_path()

    try:
        import urh.cythonext.signalFunctions
        import urh.cythonext.path_creator
        import urh.cythonext.util
    except ImportError:
        print("Could not find C++ extensions, trying to build them.")
        old_dir = os.curdir
        os.chdir(os.path.join(src_dir, "urh", "cythonext"))

        from urh.cythonext import build
        build.main()

        os.chdir(old_dir)

    from urh.controller.MainController import MainController
    from urh import constants

    if constants.SETTINGS.value("theme_index", 0, int) > 0:
        os.environ['QT_QPA_PLATFORMTHEME'] = 'fusion'

    app = QApplication(["URH"] + sys.argv[1:])
    app.setWindowIcon(QIcon(":/icons/data/icons/appicon.png"))

    if sys.platform != "linux":
        # noinspection PyUnresolvedReferences
        import urh.ui.xtra_icons_rc
        QIcon.setThemeName("oxy")

    constants.SETTINGS.setValue("default_theme", app.style().objectName())

    if constants.SETTINGS.value("theme_index", 0, int) > 0:
        app.setStyle(QStyleFactory.create("Fusion"))

        if constants.SETTINGS.value("theme_index", 0, int) == 2:
            palette = QPalette()
            background_color = QColor(56, 60, 74)
            text_color = QColor(211, 218, 227).lighter()
            palette.setColor(QPalette.Window, background_color)
            palette.setColor(QPalette.WindowText, text_color)
            palette.setColor(QPalette.Base, background_color)
            palette.setColor(QPalette.AlternateBase, background_color)
            palette.setColor(QPalette.ToolTipBase, background_color)
            palette.setColor(QPalette.ToolTipText, text_color)
            palette.setColor(QPalette.Text, text_color)

            palette.setColor(QPalette.Button, background_color)
            palette.setColor(QPalette.ButtonText, text_color)

            palette.setColor(QPalette.BrightText, Qt.red)
            palette.setColor(QPalette.Disabled, QPalette.Text, Qt.darkGray)
            palette.setColor(QPalette.Disabled, QPalette.ButtonText, Qt.darkGray)

            palette.setColor(QPalette.Highlight, QColor(200, 50, 0))
            palette.setColor(QPalette.HighlightedText, text_color)
            app.setPalette(palette)

    main_window = MainController()

    if sys.platform == "darwin":
        menu_bar = main_window.menuBar()
        menu_bar.setNativeMenuBar(False)
        import multiprocessing as mp
        mp.set_start_method("spawn")  # prevent errors with forking in native RTL-SDR backend
    elif sys.platform == "win32":
        # Ensure we get the app icon in windows taskbar
        import ctypes
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("jopohl.urh")

    main_window.showMaximized()
    # main_window.setFixedSize(1920, 1080 - 30)  # Youtube

    # use system colors for painting
    widget = QWidget()
    bgcolor = widget.palette().color(QPalette.Background)
    fgcolor = widget.palette().color(QPalette.Foreground)
    selection_color = widget.palette().color(QPalette.Highlight)
    constants.BGCOLOR = bgcolor
    constants.LINECOLOR = fgcolor
    constants.SELECTION_COLOR = selection_color
    constants.SEND_INDICATOR_COLOR = selection_color

    if "autoclose" in sys.argv[1:]:
        # Autoclose after 1 second, this is useful for automated testing
        timer = QTimer()
        timer.timeout.connect(app.quit)
        timer.start(1000)

    return_code = app.exec_()
    app.closeAllWindows()
    os._exit(return_code)  # sys.exit() is not enough on Windows and will result in crash on exit