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)
Esempio n. 2
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)
    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()
Esempio 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)
Esempio n. 5
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
Esempio n. 6
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()
Esempio n. 7
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)
Esempio n. 8
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()
Esempio n. 9
0
def nfontEditGUIStart():
    app = QApplication(sys.argv)
    ex = NFontEditWidget('__main__')
    QApplication.setStyle(QStyleFactory.create('Fusion'))
    ex.openFile()
    ex.show()
    sys.exit(app.exec_())
Esempio n. 10
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()
Esempio n. 11
0
    def styleChanged(self, styleName):
        style = QStyleFactory.create(styleName)
        if style:
            self.setStyleHelper(self, style)

        # Keep a reference to the style.
        self._style = style
Esempio n. 12
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)
Esempio n. 13
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))
Esempio n. 14
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_())
Esempio n. 15
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)
Esempio n. 16
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)
Esempio n. 17
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()
Esempio 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
Esempio n. 19
0
def createQApplication(app_name = 'Back In Time'):
    global qapp
    try:
        return qapp
    except NameError:
        pass
    qapp = QApplication(sys.argv + ['-title', app_name])
    if os.geteuid() == 0 and                                   \
        qapp.style().objectName().lower() == 'windows' and  \
        'GTK+' in QStyleFactory.keys():
            qapp.setStyle('GTK+')
    return qapp
Esempio n. 20
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))
Esempio n. 21
0
 def __populateStyleCombo(self):
     """
     Private method to populate the style combo box.
     """
     curStyle = Preferences.getUI("Style")
     styles = sorted(list(QStyleFactory.keys()))
     self.styleComboBox.addItem(self.tr('System'), "System")
     for style in styles:
         self.styleComboBox.addItem(style, style)
     currentIndex = self.styleComboBox.findData(curStyle)
     if currentIndex == -1:
         currentIndex = 0
     self.styleComboBox.setCurrentIndex(currentIndex)
Esempio n. 22
0
    def __init__(self, parent=None):
        super(WidgetGallery, self).__init__(parent)

        self.originalPalette = QApplication.palette()

        styleComboBox = QComboBox()
        styleComboBox.addItems(QStyleFactory.keys())

        styleLabel = QLabel("&Style:")
        styleLabel.setBuddy(styleComboBox)

        self.useStylePaletteCheckBox = QCheckBox("&Use style's standard palette")
        self.useStylePaletteCheckBox.setChecked(True)

        disableWidgetsCheckBox = QCheckBox("&Disable widgets")

        self.createTopLeftGroupBox()
        self.createTopRightGroupBox()
        self.createBottomLeftTabWidget()
        self.createBottomRightGroupBox()
        self.createProgressBar()

        styleComboBox.activated[str].connect(self.changeStyle)
        self.useStylePaletteCheckBox.toggled.connect(self.changePalette)
        disableWidgetsCheckBox.toggled.connect(self.topLeftGroupBox.setDisabled)
        disableWidgetsCheckBox.toggled.connect(self.topRightGroupBox.setDisabled)
        disableWidgetsCheckBox.toggled.connect(self.bottomLeftTabWidget.setDisabled)
        disableWidgetsCheckBox.toggled.connect(self.bottomRightGroupBox.setDisabled)

        topLayout = QHBoxLayout()
        topLayout.addWidget(styleLabel)
        topLayout.addWidget(styleComboBox)
        topLayout.addStretch(1)
        topLayout.addWidget(self.useStylePaletteCheckBox)
        topLayout.addWidget(disableWidgetsCheckBox)

        mainLayout = QGridLayout()
        mainLayout.addLayout(topLayout, 0, 0, 1, 2)
        mainLayout.addWidget(self.topLeftGroupBox, 1, 0)
        mainLayout.addWidget(self.topRightGroupBox, 1, 1)
        mainLayout.addWidget(self.bottomLeftTabWidget, 2, 0)
        mainLayout.addWidget(self.bottomRightGroupBox, 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("Styles")
        self.changeStyle('Windows')
Esempio n. 23
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__()
Esempio n. 24
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_())
Esempio n. 25
0
def createQApplication(app_name = 'Back In Time'):
    global qapp
    try:
        return qapp
    except NameError:
        pass
    if StrictVersion(QT_VERSION_STR) >= StrictVersion('5.6') and \
        hasattr(Qt, 'AA_EnableHighDpiScaling'):
        QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
    qapp = QApplication(sys.argv + ['-title', app_name])
    if os.geteuid() == 0 and                                   \
        qapp.style().objectName().lower() == 'windows' and  \
        'GTK+' in QStyleFactory.keys():
            qapp.setStyle('GTK+')
    return qapp
Esempio n. 26
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)
Esempio n. 27
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)
Esempio n. 28
0
    def set_settings(self, conn):
        sql_statement = "SELECT stay_on_top, style, size FROM settings WHERE id = 1"

        cur = conn.cursor()
        cur.execute(sql_statement)

        rows = cur.fetchall()

        if rows[0][0] == 2:
            QMainWindow.__init__(self, None, Qt.WindowStaysOnTopHint)

        if rows[0][1] == 0:
            QApplication.setStyle(QStyleFactory.create("Windows"))
        elif rows[0][1] == 1:
            QApplication.setStyle(QStyleFactory.create("WindowsVista"))
        elif rows[0][1] == 2:
            QApplication.setStyle(QStyleFactory.create("Fusion"))

        if rows[0][2] == 0:
            self.setGeometry(300, 100, 300, 350)
        elif rows[0][2] == 1:
            self.setGeometry(300, 100, 700, 600)
        elif rows[0][2] == 2:
            self.setGeometry(300, 100, 1000, 700)
Esempio n. 29
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__()
Esempio n. 30
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)
Esempio n. 31
0
    def __init__(self, parent=None, submit_icon=None):
        super(WidgetGallery, self).__init__(parent)

        appctx = ApplicationContext()

        spreadsheet_hdl = SpreadsheetHandler()
        categories = spreadsheet_hdl.read_categories()

        self.tabsWidget = QTabWidget()

        # Add 'Expenses' tab to main widget
        self.createExpensesLayout()
        self.tabsWidget.addTab(self.expensesWidget,
                               QIcon(appctx.get_resource("submit.ico")),
                               "Expenses")

        # Add 'Incomes' tab to main widget
        self.createIncomesLayout()
        self.tabsWidget.addTab(self.incomesWidget,
                               QIcon(appctx.get_resource("submit.ico")),
                               "Incomes")

        # Add 'Latest Uploads' tab to main widget
        self.createLatestUploads()
        self.tabsWidget.addTab(self.latestUploadsWidget,
                               QIcon(appctx.get_resource("sheets.ico")),
                               "Latest Uploads")

        # Add 'Spreadsheet Actions' tab to main widget
        self.createSpreadsheetActionsLayout()
        self.tabsWidget.addTab(self.spreadsheetActionsWidget,
                               QIcon(appctx.get_resource("sheets.ico")),
                               "Spreadsheet Actions")

        # Set the current available expenses categories
        self.addCategories(categories)

        # Set main window size
        self.resize(570, 320)

        self.tabsWidget.currentChanged.connect(self.adjustTabWidgetSize)

        self.layout = QVBoxLayout()
        self.layout.addWidget(self.tabsWidget)
        self.setLayout(self.layout)
        self.setWindowTitle("Expenses Tracker")

        QApplication.setStyle(QStyleFactory.create("Fusion"))
Esempio n. 32
0
    def __init__(self, parent=None):
        super(EmbeddedDialog, self).__init__(parent)

        self.ui = Ui_embeddedDialog()
        self.ui.setupUi(self)
        self.ui.layoutDirection.setCurrentIndex(self.layoutDirection() != Qt.LeftToRight)

        for styleName in QStyleFactory.keys():
            self.ui.style.addItem(styleName)
            if self.style().objectName().lower() == styleName.lower():
                self.ui.style.setCurrentIndex(self.ui.style.count() -1)

        self.ui.layoutDirection.activated.connect(self.layoutDirectionChanged)
        self.ui.spacing.valueChanged.connect(self.spacingChanged)
        self.ui.fontComboBox.currentFontChanged.connect(self.fontChanged)
        self.ui.style.activated[str].connect(self.styleChanged)
Esempio n. 33
0
 def changedItem(self, folder, comb):
     if folder == 'Inbox':
         self.Window = InboxWindow(self,
                                   is_change=comb,
                                   id_default=self.select_ids)
         self.setWindowTitle("Inbox")
     if folder == 'Send':
         self.Window = SendWindow(self,
                                  is_change=comb,
                                  id_default=self.select_ids)
         self.setWindowTitle("Send")
     self.setCentralWidget(self.Window)
     QApplication.setStyle(QStyleFactory.create('Cleanlooks'))
     self.Window.toolbar.triggered[QAction].connect(self.toolbtnpressed)
     self.Window.combo.currentTextChanged.connect(self.selectionchange_id)
     self.show()
Esempio n. 34
0
def execute(args):
    app = QApplication(sys.argv)
    app.setStyle(QStyleFactory.create('Fusion'))

    win = MainWindow("메인 윈도우", posX=100, posY=400, width=500, height=500)
    win.show()

    try:
        exit = app.exec()

    except Exception as e:
        traceback.print_exc()
    else:
        print('close')
    finally:
        return exit
Esempio n. 35
0
    def __init__(self, sPic):
        super().__init__()
        self.pic = sPic
        print(QStyleFactory.keys())
        self.setWindowTitle(cfg.keyboard_title)
        self.generalLayout = QVBoxLayout()
        self.showFullScreen()
        self._centralWidget = QWidget(self)
        self.setCentralWidget(self._centralWidget)
        self._centralWidget.setLayout(self.generalLayout)
        self._centralWidget.setFixedSize(560, 400)

        self._createDisplay()
        self._createButtons()
        global view
        view = self
Esempio n. 36
0
    def host(self):

        # Prompt user to set port number
        port_num, status = QInputDialog().getText(
            self.window, "Host",
            "Provide a port number between 1024 and 65535", QLineEdit.Normal)

        # Error checking for port number
        if status and (not port_num.isdigit()
                       or not (int(port_num)) in range(1023, 65536)):
            self.host()
        if status and port_num:
            self.connected = True

            try:

                # Prompt waiting for other user
                self.chat_status.setText("Waiting for connection")

                # Starting server
                self.socket.bind(("0.0.0.0", int(port_num)))
                self.socket.listen()
                other, client = self.socket.accept()
                self.socket.close()
                self.socket = other

                # Message for established connection
                self.chat_status.setText("Established connection with " +
                                         str(client))

                # Listening
                self.listen = Listener(other)
                self.listen.start()
                self.listen.finished.connect(self.close_connection)
                self.listen.signal.connect(self.create_mes)

            except:
                self.connected = False
                connect_error = QMessageBox()
                connect_error.setText(
                    "Something went wrong.  Please try again")
                connect_error.setStyle(QStyleFactory.create("Fusion"))
                connect_error.setStyleSheet(
                    "font:bold; color: rgb(153, 170, 181); background-color: rgb(44, 47, 51); font-size: 12px"
                )
                connect_error.exec()
                traceback.print_exc(file=sys.stdout)
Esempio n. 37
0
 def __init__(self, parent=None):
     super().__init__(parent)
     center = QWidget()
     main_layout = QGridLayout(center)
     main_layout.addLayout(self.create_keyword_area(), 0, 0)
     main_layout.setColumnMinimumWidth(0, 350)
     self.file_headers = ['files']
     main_layout.addLayout(self.create_files_area(), 0, 1)
     main_layout.setColumnMinimumWidth(1, 650)
     main_layout.setColumnStretch(1, 1)
     main_layout.setRowMinimumHeight(0, 500)
     self.setCentralWidget(center)
     self.setWindowTitle('File Scanner')
     QApplication.setStyle(QStyleFactory.create('windowsvista'))
     self.file_names = []
     self.options = Options(self)
     self.show()
Esempio n. 38
0
 def __init__(self, parent=None, flags=Qt.FramelessWindowHint):
     super(VCProgressBar, self).__init__(parent, flags)
     self.parent = parent
     if sys.platform.startswith('linux'):
         self.taskbar = TaskbarProgress(self)
     self._progress = QProgressBar(self.parent)
     self._progress.setRange(0, 0)
     self._progress.setTextVisible(False)
     self._progress.setStyle(QStyleFactory.create('fusion'))
     self._label = QLabel(parent)
     self._label.setAlignment(Qt.AlignCenter)
     layout = QGridLayout()
     layout.addWidget(self._progress, 0, 0)
     layout.addWidget(self._label, 0, 0)
     self.setWindowModality(Qt.ApplicationModal)
     self.setMinimumWidth(500)
     self.setLayout(layout)
Esempio n. 39
0
def start():
    with client:

        # get out connections
        playback = client.get_ports(is_physical=True, is_input=True)
        if not playback:
            raise RuntimeError("No physical playback ports")
        
        # get in connections
        record = client.get_ports(is_physical=True, is_output=True)
        if not record:
            raise RuntimeError("No physical input ports")


        # autoconnect
        if settings.auto_connect_input:
            # connect inputs
            try:
                client.connect(record[0], inL)
                client.connect(record[1], inR)
            except:
                raise RuntimeError("Error connecting input ports. Check JACK Settings")

        if settings.auto_connect_output:
            # connect Master output:
            try:
                client.connect(masterL, playback[0])
                client.connect(masterR, playback[1])
            except:
                raise RuntimeError("Error connecting Master out ports. Check JACK Settings")                


        # forcing Qt theme to prevent graphics changes from original style
        #style = QStyleFactory.create('gtk2')
        style = QStyleFactory.create('Fusion')
        app.setStyle(style)

        #print(QStyleFactory.keys())

        # set themes
        #import superboucle.qtmodern.styles
        #import superboucle.qtmodern.windows
        #superboucle.qtmodern.styles.light(app)


        app.exec_()
Esempio n. 40
0
    def __init__(self, parent=None):
        super(WidgetGallery, self).__init__(parent)
        self.showMaximized()
        self.textEditprocessedSourceCode = None
        self.textEditSourceCode = None

        self.originalPalette = QApplication.palette()

        styleComboBox = QComboBox()
        styleComboBox.addItems(QStyleFactory.keys())

        styleLabel = QLabel("E&stilo:")
        styleLabel.setBuddy(styleComboBox)

        self.useStylePaletteCheckBox = QCheckBox(
            "&Usar estilos predeterminados")
        self.useStylePaletteCheckBox.setChecked(True)

        self.createTopLeftGroupBox()
        self.createTopRightGroupBox()

        styleComboBox.activated[str].connect(self.changeStyle)
        self.useStylePaletteCheckBox.toggled.connect(self.changePalette)

        topLayout = QHBoxLayout()
        topLayout.addWidget(styleLabel)
        topLayout.addWidget(styleComboBox)
        topLayout.addStretch(1)
        topLayout.addWidget(self.useStylePaletteCheckBox)

        mainLayout = QGridLayout()
        mainLayout.addLayout(topLayout, 0, 0, 1, 2)
        mainLayout.addWidget(self.topLeftGroupBox, 1, 0, 2, 1)
        mainLayout.addWidget(self.topRightGroupBox, 1, 1)
        mainLayout.addWidget(self.bottomRightTabWidget, 2, 1)

        mainLayout.setRowStretch(1, 1)
        mainLayout.setRowStretch(2, 1)

        mainLayout.setColumnStretch(0, 1)
        mainLayout.setColumnStretch(1, 2)

        self.setLayout(mainLayout)

        self.setWindowTitle("Proyecto X")
        self.changeStyle('fusion')
    def __init__(self, data=None, parent=None):
        super().__init__(parent)

        self.original_palette = QApplication.palette()
        QApplication.setStyle(QStyleFactory.create('fusion'))
        QApplication.setPalette(self.original_palette)

        self.platform = platform.system()

        if self.detect_darkmode_in_windows():
            self.dark_mode = True
            self.set_dark_palette(self)
        else:
            self.dark_mode = False

        self.resize(800, 500)
        self.setWindowTitle(f'WifiPasswords-GUI {__version__}')
        self.setWindowIcon(QIcon(resource_path('icons8-flatcolor-unlock.ico')))

        self.placeholder_data = {
            'Loading': {
                'auth': ' ',
                'psk': ' ',
                'metered': False,
                'macrandom': 'Disabled'
            }
        }

        if data == None:
            self.data = self.placeholder_data
        else:
            self.data = data

        self.create_table_group()
        self.run_get_data_thread()

        self.create_button_group()
        self.buttons_disabled(True)

        main = QGridLayout()
        main.setContentsMargins(3, 3, 3, 3)
        self.setContentsMargins(3, 3, 3, 3)
        main.addWidget(self.table_group, 1, 0)
        main.addWidget(self.button_group, 2, 0)
        self.setLayout(main)
Esempio n. 42
0
    def __init__(self, style_dict=default_style):
        '''Create a GUI style.

        - style_dict : the dictionary containing the style colors.
        '''

        self.style_dict = style_dict
        self.style_sheet = self.to_css(style_dict)

        self.main_styles = (*QStyleFactory.keys(), 'Dark fusion')

        if style_dict['main_style'] in self.main_styles:
            self.main_style_name = style_dict['main_style']

        else:
            self.main_style_name = self.main_styles[0]

        self.set_style(self.main_style_name)
Esempio n. 43
0
def main():
    sys.excepthook = excepthook
    cli = BaseCLI("DERIVA Authentication Agent",
                  "For more information see: https://github.com/informatics-isi-edu/deriva-qt", VERSION)
    cli.parser.add_argument(
        "--cookie-persistence", action="store_true",
        help="Enable cookie and local storage persistence for QtWebEngine.")
    args = cli.parse_cli()
    QApplication.setDesktopSettingsAware(False)
    QApplication.setStyle(QStyleFactory.create("Fusion"))
    app = QApplication(sys.argv)
    app.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps)
    config = read_config(args.config_file, create_default=False) if args.config_file else None
    log_level = logging.DEBUG if args.debug else logging.INFO
    auth_window = AuthWindow(config, args.credential_file,
                             cookie_persistence=args.cookie_persistence, log_level=log_level)
    auth_window.show()
    return app.exec()
Esempio n. 44
0
 def loadSettings(self):
     s = QSettings()
     lang = s.value("language", "", str)
     try:
         index = self._langs.index(lang)
     except ValueError:
         index = 1
     self.lang.setCurrentIndex(index)
     style = s.value("guistyle", "", str).lower()
     styles = [name.lower() for name in QStyleFactory.keys()]
     try:
         index = styles.index(style) + 1
     except ValueError:
         index = 0
     self.styleCombo.setCurrentIndex(index)
     self.systemIcons.setChecked(s.value("system_icons", True, bool))
     self.tabsClosable.setChecked(s.value("tabs_closable", True, bool))
     self.splashScreen.setChecked(s.value("splash_screen", True, bool))
     self.allowRemote.setChecked(remote.enabled())
Esempio n. 45
0
    def __init__(self, parent=None):
        super(StyleSheetEditor, self).__init__(parent)

        self.ui = Ui_StyleSheetEditor()
        self.ui.setupUi(self)

        regExp = QRegExp(r'.(.*)\+?Style')
        defaultStyle = QApplication.style().metaObject().className()
        if regExp.exactMatch(defaultStyle):
            defaultStyle = regExp.cap(1)

        self.ui.styleCombo.addItems(QStyleFactory.keys())
        self.ui.styleCombo.setCurrentIndex(
                self.ui.styleCombo.findText(defaultStyle, Qt.MatchContains))

        self.ui.styleSheetCombo.setCurrentIndex(
                self.ui.styleSheetCombo.findText('Coffee'))

        self.loadStyleSheet('Coffee')