Python qdarkstyle.load_stylesheet() Examples

The following are 9 code examples of qdarkstyle.load_stylesheet(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module qdarkstyle , or try the search function .
Example #1
Source File: example_pyqt.py    From PyQt5_stylesheets with Apache License 2.0 5 votes vote down vote up
def main():
    """
    Application entry point
    """
    logging.basicConfig(level=logging.DEBUG)
    # create the application and the main window
    app = QtGui.QApplication(sys.argv)
    window = QtGui.QMainWindow()

    # setup ui
    ui = example_ui.Ui_MainWindow()
    ui.setupUi(window)
    ui.bt_delay_popup.addActions([
        ui.actionAction,
        ui.actionAction_C
    ])
    ui.bt_instant_popup.addActions([
        ui.actionAction,
        ui.actionAction_C
    ])
    ui.bt_menu_button_popup.addActions([
        ui.actionAction,
        ui.actionAction_C
    ])
    window.setWindowTitle("QDarkStyle example")

    # tabify dock widgets to show bug #6
    window.tabifyDockWidget(ui.dockWidget1, ui.dockWidget2)

    # setup stylesheet
    app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=False))

    # auto quit after 2s when testing on travis-ci
    if "--travis" in sys.argv:
        QtCore.QTimer.singleShot(2000, app.exit)

    # run
    window.show()
    app.exec_() 
Example #2
Source File: example_pyside.py    From PyQt5_stylesheets with Apache License 2.0 5 votes vote down vote up
def main():
    """
    Application entry point
    """
    logging.basicConfig(level=logging.DEBUG)
    # create the application and the main window
    app = QtGui.QApplication(sys.argv)
    window = QtGui.QMainWindow()

    # setup ui
    ui = example_ui.Ui_MainWindow()
    ui.setupUi(window)
    ui.bt_delay_popup.addActions([
        ui.actionAction,
        ui.actionAction_C
    ])
    ui.bt_instant_popup.addActions([
        ui.actionAction,
        ui.actionAction_C
    ])
    ui.bt_menu_button_popup.addActions([
        ui.actionAction,
        ui.actionAction_C
    ])
    window.setWindowTitle("QDarkStyle example")

    # tabify dock widgets to show bug #6
    window.tabifyDockWidget(ui.dockWidget1, ui.dockWidget2)

    # setup stylesheet
    app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=True))

    # auto quit after 2s when testing on travis-ci
    if "--travis" in sys.argv:
        QtCore.QTimer.singleShot(2000, app.exit)

    # run
    window.show()
    app.exec_() 
Example #3
Source File: vtMain.py    From chanlun with MIT License 5 votes vote down vote up
def main():
    """主程序入口"""
    # 重载sys模块,设置默认字符串编码方式为utf8
    reload(sys)
    sys.setdefaultencoding('utf8')
    
    # 设置Windows底部任务栏图标
    if 'Windows' in platform.uname() :
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('vn.trader')  

    # 初始化Qt应用对象
    app = QtGui.QApplication(sys.argv)
    app.setWindowIcon(QtGui.QIcon('meng.ico'))
    app.setFont(BASIC_FONT)
    
    # 设置Qt的皮肤
    try:
        f = file("VT_setting.json")
        setting = json.load(f)    
        if setting['darkStyle']:
            import qdarkstyle
            app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=False))
    except:
        pass
    
    # 初始化主引擎和主窗口对象
    mainEngine = MainEngine()
    mainWindow = MainWindow(mainEngine, mainEngine.eventEngine)
    mainWindow.showMaximized()
    
    # 在主线程中启动Qt事件循环
    sys.exit(app.exec_()) 
Example #4
Source File: main.py    From InplusTrader_Linux with MIT License 5 votes vote down vote up
def main():
    """主程序入口"""
    # 重载sys模块,设置默认字符串编码方式为utf8
    reload(sys)
    sys.setdefaultencoding('utf8')
    
    # 设置Windows底部任务栏图标
    if 'Windows' in platform.uname() :
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('InplusTrader')
    
    # 初始化Qt应用对象
    app = QtGui.QApplication(sys.argv)
    app.setWindowIcon(QtGui.QIcon(ICON_FILENAME))
    app.setFont(BASIC_FONT)
    
    # 设置Qt的皮肤
    try:
        f = file(SETTING_FILENAME)
        setting = json.load(f)    
        if setting['darkStyle']:
            import qdarkstyle
            app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=False))
    except:
        pass
    
    # 初始化主引擎和主窗口对象
    mainEngine = MainEngine()
    mainWindow = MainWindow(mainEngine, mainEngine.eventEngine)
    mainWindow.showMaximized()
    
    # 在主线程中启动Qt事件循环
    sys.exit(app.exec_()) 
Example #5
Source File: labelImg.py    From LabelImgTool with MIT License 5 votes vote down vote up
def main(argv):
    """Standard boilerplate Qt application code."""
    app = QApplication(argv)
    app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=False))
    app.setApplicationName(__appname__)
    app.setWindowIcon(newIcon("app"))
    win = MainWindow(argv[1] if len(argv) == 2 else None)
    win.show()
    return app.exec_() 
Example #6
Source File: application.py    From codimension with GNU General Public License v3.0 4 votes vote down vote up
def __init__(self, argv, style):
        QApplication.__init__(self, argv)

        # Sick! The QT doc recommends the following:
        # "To ensure that the application's style is set correctly, it is best
        # to call this function before the QApplication constructor, if
        # possible". However if I do it before QApplication.__init__() then
        # there is a crash! At least with some styles on Ubuntu 12.04 64 bit.
        # So I have to call the initialization after the __init__ call.
        QApplication.setStyle(style)

        self.mainWindow = None
        self.__lastFocus = None
        self.__beforeMenuBar = None

        # Sick! It seems that QT sends Activate/Deactivate signals every time
        # a dialog window is opened/closed. This happens very quickly (and
        # totally unexpected!). So the last focus widget must not be focused
        # unconditionally as the last focus may come from a dialog which has
        # already been destroyed. Without checking that a widget is still alive
        # (e.g. clicking 'Cancel' in a dialog box) leads to a core dump.

        QApplication.setWindowIcon(getIcon('icon.png'))

        self.focusChanged.connect(self.__onFocusChanged)

        appCSS = ''
        if GlobalData().skin['dark']:
            appCSS = qdarkstyle.load_stylesheet(qt_api='pyqt5')
            #appCSS = appCSS.replace('QStatusBar QLabel',
            #                        'QStatusBar QComboBox')
            #appCSS = appCSS.replace('QStatusBar::item',
            #                        'QStatusBar QComboBox')

        # Avoid having rectangular frames on the status bar and
        # some application wide style changes
        adjustmentCSS = GlobalData().skin['appCSS']
        if adjustmentCSS:
            appCSS += '\n' + adjustmentCSS

        if appCSS:
            self.setStyleSheet(appCSS)

        # Install custom GC
        self.__gc = GarbageCollector(self)

        self.installEventFilter(self) 
Example #7
Source File: vtClient.py    From vnpy_crypto with MIT License 4 votes vote down vote up
def main():
    """客户端主程序入口"""

    # 设置Windows底部任务栏图标
    if 'Windows' in platform.uname() :
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('vn.trader')    
    
    # 创建事件引擎
    eventEngine = EventEngine()
    eventEngine.start(timer=False)

    # 创建客户端
    reqAddress = 'tcp://localhost:2114'
    subAddress = 'tcp://localhost:2116'
    client = VtClient(reqAddress, subAddress, eventEngine)

    # 这里是订阅所有的publish event,也可以指定。
    client.subscribeTopic('')
    client.start()

    # 初始化Qt应用对象
    app = QtGui.QApplication(sys.argv)
    app.setWindowIcon(QtGui.QIcon(ICON_FILENAME))
    app.setFont(BASIC_FONT)
    
    # 设置Qt的皮肤
    try:
        from vnpy.trader.vtGlobal import globalSetting

        if globalSetting['darkStyle']:
            import qdarkstyle
            app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=False))
    except:
        pass    
    
    # 初始化主引擎和主窗口对象
    mainEngine = ClientEngine(client, eventEngine)
    mainWindow = MainWindow(mainEngine, mainEngine.eventEngine)
    mainWindow.showMaximized()
    
    # 在主线程中启动Qt事件循环
    sys.exit(app.exec_()) 
Example #8
Source File: vtMain.py    From TradeSim with Apache License 2.0 4 votes vote down vote up
def main():
    """主程序入口"""
    # 重载sys模块,设置默认字符串编码方式为utf8
    '''
    reload(sys)
    try:
        sys.setdefaultencoding('utf8')
    except:
        pass
    '''
    
    # 设置Windows底部任务栏图标
    if 'Windows' in platform.uname() :
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('vn.trader')  

    # 初始化Qt应用对象
    icon = os.path.join(os.getcwd(), 'setting', 'vnpy.ico')
    
    app = QApplication(['VnTrader',''])
    app.setWindowIcon(QIcon(icon))
    app.setFont(BASIC_FONT)
    
    darksheet = qdarkstyle.load_stylesheet(pyside=False)
    whitesheet = app.styleSheet()
    sheets = [whitesheet, darksheet]
    # 设置Qt的皮肤
    try:
        f = open("setting/VT_setting.json")
        setting = json.load(f)
        if setting['darkStyle']:
            app.setStyleSheet(darksheet)
            sheets = [darksheet, whitesheet]
    except:
        pass
    
    # 初始化主引擎和主窗口对象
    mainEngine = MainEngine()
    mainWindow = MainWindow(mainEngine, mainEngine.eventEngine, app, sheets)
    mainWindow.showMaximized()
    mainWindow.showLogin()
    
    # 在主线程中启动Qt事件循环
    sys.exit(app.exec_()) 
Example #9
Source File: vtClient.py    From InplusTrader_Linux with MIT License 4 votes vote down vote up
def main():
    """客户端主程序入口"""
    # 重载sys模块,设置默认字符串编码方式为utf8
    reload(sys)
    sys.setdefaultencoding('utf8')    
    
    # 设置Windows底部任务栏图标
    if 'Windows' in platform.uname() :
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID('vn.trader')    
    
    # 创建事件引擎
    eventEngine = EventEngine()
    eventEngine.start(timer=False)

    # 创建客户端
    reqAddress = 'tcp://localhost:2014'
    subAddress = 'tcp://localhost:0602'
    client = VtClient(reqAddress, subAddress, eventEngine)

    client.subscribeTopic('')
    client.start()
    
    # 初始化Qt应用对象
    app = QtGui.QApplication(sys.argv)
    app.setWindowIcon(QtGui.QIcon(ICON_FILENAME))
    app.setFont(BASIC_FONT)
    
    # 设置Qt的皮肤
    try:
        f = file(SETTING_FILENAME)
        setting = json.load(f)    
        if setting['darkStyle']:
            import qdarkstyle
            app.setStyleSheet(qdarkstyle.load_stylesheet(pyside=False))
    except:
        pass    
    
    # 初始化主引擎和主窗口对象
    mainEngine = ClientEngine(client, eventEngine)
    mainWindow = MainWindow(mainEngine, mainEngine.eventEngine)
    mainWindow.showMaximized()
    
    # 在主线程中启动Qt事件循环
    sys.exit(app.exec_())