當前位置: 首頁>>代碼示例>>Python>>正文


Python qdarkstyle.load_stylesheet方法代碼示例

本文整理匯總了Python中qdarkstyle.load_stylesheet方法的典型用法代碼示例。如果您正苦於以下問題:Python qdarkstyle.load_stylesheet方法的具體用法?Python qdarkstyle.load_stylesheet怎麽用?Python qdarkstyle.load_stylesheet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在qdarkstyle的用法示例。


在下文中一共展示了qdarkstyle.load_stylesheet方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: import qdarkstyle [as 別名]
# 或者: from qdarkstyle import load_stylesheet [as 別名]
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_() 
開發者ID:RedFalsh,項目名稱:PyQt5_stylesheets,代碼行數:41,代碼來源:example_pyqt.py

示例2: main

# 需要導入模塊: import qdarkstyle [as 別名]
# 或者: from qdarkstyle import load_stylesheet [as 別名]
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_() 
開發者ID:RedFalsh,項目名稱:PyQt5_stylesheets,代碼行數:41,代碼來源:example_pyside.py

示例3: main

# 需要導入模塊: import qdarkstyle [as 別名]
# 或者: from qdarkstyle import load_stylesheet [as 別名]
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_()) 
開發者ID:sunshinelover,項目名稱:chanlun,代碼行數:34,代碼來源:vtMain.py

示例4: main

# 需要導入模塊: import qdarkstyle [as 別名]
# 或者: from qdarkstyle import load_stylesheet [as 別名]
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_()) 
開發者ID:zhengwsh,項目名稱:InplusTrader_Linux,代碼行數:34,代碼來源:main.py

示例5: main

# 需要導入模塊: import qdarkstyle [as 別名]
# 或者: from qdarkstyle import load_stylesheet [as 別名]
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_() 
開發者ID:lzx1413,項目名稱:LabelImgTool,代碼行數:11,代碼來源:labelImg.py

示例6: __init__

# 需要導入模塊: import qdarkstyle [as 別名]
# 或者: from qdarkstyle import load_stylesheet [as 別名]
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) 
開發者ID:SergeySatskiy,項目名稱:codimension,代碼行數:49,代碼來源:application.py

示例7: main

# 需要導入模塊: import qdarkstyle [as 別名]
# 或者: from qdarkstyle import load_stylesheet [as 別名]
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_()) 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:44,代碼來源:vtClient.py

示例8: main

# 需要導入模塊: import qdarkstyle [as 別名]
# 或者: from qdarkstyle import load_stylesheet [as 別名]
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_()) 
開發者ID:quantOS-org,項目名稱:TradeSim,代碼行數:45,代碼來源:vtMain.py

示例9: main

# 需要導入模塊: import qdarkstyle [as 別名]
# 或者: from qdarkstyle import load_stylesheet [as 別名]
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_()) 
開發者ID:zhengwsh,項目名稱:InplusTrader_Linux,代碼行數:46,代碼來源:vtClient.py


注:本文中的qdarkstyle.load_stylesheet方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。