Ejemplo n.º 1
0
def main(args):
    app = QApplication(args)
    app.setApplicationName(__APPNAME__)
    app.setApplicationVersion(__VERSION__)
    app.setOrganizationName(__ORG__)
    app.setOrganizationDomain(__ORGDOMAIN__)
    mainwindow = MaeBird()
    mainwindow.show()
    app.exec_()
    del mainwindow
Ejemplo n.º 2
0
def main():
	QApplication.setColorSpec(QApplication.ManyColor)
	app = QApplication(sys.argv)
	app.setOrganizationName("NJN Ltd.")
	app.setOrganizationDomain("e-nool.blogspot.com")
	app.setApplicationName("Nigandu English to Tamil Dictionary")
	app.setWindowIcon(QIcon(":/icons/njnlogo.png"))
	form = mainwin()
	form.show()
	app.exec_()
Ejemplo n.º 3
0
def main():
    'Main Program Entry Point'
    QResource.registerResource('res/icons.rcc')
    
    app = QApplication(sys.argv)
    app.setOrganizationName(__ORG_NAME)
    app.setOrganizationDomain(__ORG_DOMAIN)
    app.setApplicationName(__APP_NAME)
    app.setApplicationVersion(__APP_VERSION)
    
    w = TransferPanel()
    w.show()
    
    sys.exit(app.exec_())
Ejemplo n.º 4
0
def main():
    #Start the Flask server in a new thread.
    startServerThread()

    #Now start the main UI.
    app = QApplication(sys.argv)
    app.setOrganizationName("Guru")
    app.setOrganizationDomain("rwu.edu")
    app.setApplicationName("Guru")

    main_window = MainWindow(isWelcome=True)
    main_window.show()
    main_window.activateWindow() #This does not work for some reason.
    main_window.raise_()         #But this does.
    app.exec_()

    cleanup()
Ejemplo n.º 5
0
class CinemolApp(object):
    def __init__(self):
        pass

    def launch(self):
        self.app = QApplication(sys.argv)
        self.app.setOrganizationName("rotatingpenguin.com")
        self.app.setApplicationName("Cinemol")
        self.mainWin = MainWindow()
        self.renderer = CinemolRenderer()
        # self.renderer.actors.append(Sphere2TestScene())
        self.renderer.actors.append(FiveBallScene())
        # self.renderer.actors.append(TeapotActor())
        self.mainWin.ui.glCanvas.set_gl_renderer(self.renderer)
        console_context.cm._set_app(self)
        self.mainWin.show()
        sys.exit(self.app.exec_())
Ejemplo n.º 6
0
def main():
  app = QApplication(sys.argv)
  try:
    auto_update()
  except:
    pass

  app.setOrganizationName("Deca Technologies")
  app.setOrganizationDomain("decatechnologies.com")
  app.setApplicationName("Pyrite")

  # create app environment
  window = MainWindow()
  window.show()

  # run main application loop
  sys.exit(app.exec_())
def main():
    # Fix for PySide on OSX Mavericks
    import sys
    if sys.platform.startswith("darwin"):
        from PySide.QtGui import QFont
        QFont.insertSubstitution(".Lucida Grande UI", "Lucida Grande")

    app = QApplication(sys.argv)
    app.setObjectName(APPNAME)
    app.setApplicationName(APPNAME)
    app.setOrganizationName(ORGNAME)
    app.setOrganizationDomain(ORGDOMAIN)

    mainWindow = RegistrationShop(sys.argv)
    mainWindow.raise_()
    mainWindow.show()
    mainWindow.initialize()
    sys.exit(app.exec_())
Ejemplo n.º 8
0
def main():
    """
    """
    from MainWindow import MainWindow

    translator = QTranslator() #Build the translator
    translator.load(":/locales/df_%s" % QLocale.system().name())
    qttranslator = QTranslator()#A translator for Qt standard strings
    qttranslator.load("qt_%s" % (QLocale.system().name()))
    App = QApplication(sys.argv) #Creating the app
    App.setOrganizationName(ORGNAME) #Setting organization and application's
    App.setApplicationName(NAME)#name. It's only useful for QSettings
    App.setApplicationVersion(VERSION)
    App.setOrganizationDomain(URL)
    App.installTranslator(translator)#Install translators into the application.
    App.installTranslator(qttranslator)
    mw = MainWindow(App) #Now it's time to instantiate the main window
    mw.show() #And show it
    sys.exit(App.exec_()) #When the app finishes, exit.
Ejemplo n.º 9
0
def main():
    QApplication.setOrganizationName('OpenBossa')
    QApplication.setApplicationName('mobtrans')
    QApplication.setGraphicsSystem('raster')
    app = QApplication([])
    serverConfig = ServerConfig()
    server = Server(serverConfig)
    model = TorrentModel(server)
    searchModel = SearchModel()

    view = QDeclarativeView()
    #view.setMinimumSize(800, 600)
    view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
    view.rootContext().setContextProperty('server', server)
    view.rootContext().setContextProperty('torrentModel', model)
    view.rootContext().setContextProperty('searchModel', searchModel)
    view.setSource(QUrl.fromLocalFile('./qml/main.qml'))
    view.show()
    app.exec_()
Ejemplo n.º 10
0
def main():
    """
    """
    from MainWindow import MainWindow

    translator = QTranslator()  #Build the translator
    translator.load(":/locales/df_%s" % QLocale.system().name())
    qttranslator = QTranslator()  #A translator for Qt standard strings
    qttranslator.load("qt_%s" % (QLocale.system().name()))
    App = QApplication(sys.argv)  #Creating the app
    App.setOrganizationName(ORGNAME)  #Setting organization and application's
    App.setApplicationName(NAME)  #name. It's only useful for QSettings
    App.setApplicationVersion(VERSION)
    App.setOrganizationDomain(URL)
    App.installTranslator(
        translator)  #Install translators into the application.
    App.installTranslator(qttranslator)
    mw = MainWindow(App)  #Now it's time to instantiate the main window
    mw.show()  #And show it
    sys.exit(App.exec_())  #When the app finishes, exit.
Ejemplo n.º 11
0
def main():
    """Execute QDarkStyle example."""
    parser = argparse.ArgumentParser(description=__doc__,
                                     formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument('--qt_from', default='pyqt',
                        choices=['pyqt', 'pyqt5', 'pyside', 'qtpy', 'pyqtgraph'],
                        help="Choose which wrapper/framework is to be used to run the example.", type=str)
    parser.add_argument('--no_dark', action='store_true',
                        help="Exihibts the original  window (without qdarkstyle).")
    parser.add_argument('--test', action='store_true',
                        help="Auto close window after 2s.")
    # parsing arguments from command line
    args = parser.parse_args()

    # set log for debug
    logging.basicConfig(level=logging.DEBUG)

    if args.qt_from == 'pyside':
        # using PySide wrapper
        from PySide.QtGui import QApplication, QMainWindow, QDockWidget
        from PySide.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # import examples UI according to wrapper
        from ui.mw_menus_pyside_ui import Ui_MainWindow as ui_main

        from ui.dw_buttons_pyside_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_pyside_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_pyside_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_pyside_ui import Ui_DockWidget as ui_inputs_no_fields

        from ui.dw_widgets_pyside_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_pyside_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_pyside_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_pyside_ui import Ui_DockWidget as ui_containers_no_tabs
        # getting style
        style = qdarkstyle.load_stylesheet_pyside()

    elif args.qt_from == 'pyqt':
        # using PyQt4 wrapper
        from PyQt4.QtGui import QApplication, QMainWindow, QDockWidget
        from PyQt4.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # import examples UI according to wrapper
        from ui.mw_menus_pyqt_ui import Ui_MainWindow as ui_main

        from ui.dw_buttons_pyqt_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_pyqt_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_pyqt_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_pyqt_ui import Ui_DockWidget as ui_inputs_no_fields

        from ui.dw_widgets_pyqt_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_pyqt_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_pyqt_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_pyqt_ui import Ui_DockWidget as ui_containers_no_tabs
        # getting style
        style = qdarkstyle.load_stylesheet_pyqt()

    elif args.qt_from == 'pyqt5':
        # using PyQt5 wrapper
        from PyQt5.QtWidgets import QApplication, QMainWindow, QDockWidget
        from PyQt5.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # import examples UI according to wrapper
        from ui.mw_menus_pyqt5_ui import Ui_MainWindow as ui_main

        from ui.dw_buttons_pyqt5_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_pyqt5_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_pyqt5_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_pyqt5_ui import Ui_DockWidget as ui_inputs_no_fields

        from ui.dw_widgets_pyqt5_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_pyqt5_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_pyqt5_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_pyqt5_ui import Ui_DockWidget as ui_containers_no_tabs
        # getting style
        style = qdarkstyle.load_stylesheet_pyqt5()

    elif args.qt_from == 'qtpy':
        # using QtPy API
        from qtpy.QtWidgets import QApplication, QMainWindow, QDockWidget
        from qtpy.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # import examples UI according to wrapper
        from ui.mw_menus_qtpy_ui import Ui_MainWindow as ui_main

        from ui.dw_buttons_qtpy_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_qtpy_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_qtpy_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_qtpy_ui import Ui_DockWidget as ui_inputs_no_fields

        from ui.dw_widgets_qtpy_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_qtpy_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_qtpy_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_qtpy_ui import Ui_DockWidget as ui_containers_no_tabs
        # getting style
        style = qdarkstyle.load_stylesheet_from_environment()

    elif args.qt_from == 'pyqtgraph':
        # using PyQtGraph API
        from pyqtgraph.Qt.QtGui import QApplication, QMainWindow, QDockWidget
        from pyqtgraph.Qt.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        #from pyqtgraph.Qt import QtGui, QtCore
        # import examples UI according to wrapper
        from ui.mw_menus_pyqtgraph_ui import Ui_MainWindow as ui_main
        from ui.dw_buttons_pyqtgraph_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_pyqtgraph_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_pyqtgraph_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_pyqtgraph_ui import Ui_DockWidget as ui_inputs_no_fields
        from ui.dw_widgets_pyqtgraph_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_pyqtgraph_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_pyqtgraph_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_pyqtgraph_ui import Ui_DockWidget as ui_containers_no_tabs
        # getting style
        style = qdarkstyle.load_stylesheet_from_environment(is_pyqtgraph=True)

    if args.no_dark:
        style = ''

    def write_settings(window):
        """Get window settings and write it into a file."""
        settings = QSettings('QDarkStyle', 'QDarkStyle Example')
        settings.setValue('pos', window.pos())
        settings.setValue('size', window.size())
        settings.setValue('state', window.saveState())

    def read_settings(window):
        """Read and set window settings from a file."""
        settings = QSettings('QDarkStyle', 'QDarkStyle Example')
        if args.qt_from == 'pyside':
            pos = settings.value('pos', window.pos())
            size = settings.value('size', window.size())
            state = settings.value('state', window.saveState())
        else:
            pos = settings.value('pos', window.pos(), type='QPoint')
            size = settings.value('size', window.size(), type='QSize')
            state = settings.value('state', window.saveState(), type='QByteArray')
        window.restoreState(state)
        window.resize(size)
        window.move(pos)

    # create the application
    app = QApplication(sys.argv)
    app.setOrganizationName('QDarkStyle')
    app.setApplicationName('QDarkStyle Example')

    # setup stylesheet
    app.setStyleSheet(style)

    # create main window
    window = QMainWindow()
    window.setObjectName('mainwindow')
    ui = ui_main()
    ui.setupUi(window)
    window.setWindowTitle("QDarkStyle v." + qdarkstyle.__version__ +
                          " - Example - Using " + args.qt_from)

    # create docks for buttons
    dw_buttons = QDockWidget()
    dw_buttons.setObjectName('buttons')
    ui_buttons = ui_buttons()
    ui_buttons.setupUi(dw_buttons)
    window.addDockWidget(Qt.RightDockWidgetArea, dw_buttons)

    # create docks for buttons
    dw_displays = QDockWidget()
    dw_displays.setObjectName('displays')
    ui_displays = ui_displays()
    ui_displays.setupUi(dw_displays)
    window.addDockWidget(Qt.RightDockWidgetArea, dw_displays)

    # create docks for inputs - fields
    dw_inputs_fields = QDockWidget()
    dw_inputs_fields.setObjectName('_fields')
    ui_inputs_fields = ui_inputs_fields()
    ui_inputs_fields.setupUi(dw_inputs_fields)
    window.addDockWidget(Qt.RightDockWidgetArea, dw_inputs_fields)

    # create docks for inputs - no fields
    dw_inputs_no_fields = QDockWidget()
    dw_inputs_no_fields.setObjectName('inputs_no_fields')
    ui_inputs_no_fields = ui_inputs_no_fields()
    ui_inputs_no_fields.setupUi(dw_inputs_no_fields)
    window.addDockWidget(Qt.RightDockWidgetArea, dw_inputs_no_fields)

    # create docks for widgets
    dw_widgets = QDockWidget()
    dw_widgets.setObjectName('widgets')
    ui_widgets = ui_widgets()
    ui_widgets.setupUi(dw_widgets)
    window.addDockWidget(Qt.LeftDockWidgetArea, dw_widgets)

    # create docks for views
    dw_views = QDockWidget()
    dw_views.setObjectName('views')
    ui_views = ui_views()
    ui_views.setupUi(dw_views)
    window.addDockWidget(Qt.LeftDockWidgetArea, dw_views)

    # create docks for containters - tabs
    dw_containers_tabs = QDockWidget()
    dw_containers_tabs.setObjectName('containers')
    ui_containers_tabs = ui_containers_tabs()
    ui_containers_tabs.setupUi(dw_containers_tabs)
    window.addDockWidget(Qt.LeftDockWidgetArea, dw_containers_tabs)

    # create docks for containers - no tabs
    dw_containers_no_tabs = QDockWidget()
    dw_containers_no_tabs.setObjectName('containers_no_tabs')
    ui_containers_no_tabs = ui_containers_no_tabs()
    ui_containers_no_tabs.setupUi(dw_containers_no_tabs)
    window.addDockWidget(Qt.LeftDockWidgetArea, dw_containers_no_tabs)

    # tabify right docks
    window.tabifyDockWidget(dw_buttons, dw_displays)
    window.tabifyDockWidget(dw_displays, dw_inputs_fields)
    window.tabifyDockWidget(dw_inputs_fields, dw_inputs_no_fields)

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

    # run
    read_settings(window)
    window.showMaximized()
    app.exec_()
    write_settings(window)
Ejemplo n.º 12
0
#!/usr/bin/env python

if __name__ == "__main__":
    """Python entry point."""

    from sys import argv
    from PySide.QtGui import QApplication
    from caerus.controller import Controller

    qt = QApplication(argv)

    qt.setApplicationName("Caerus")
    qt.setApplicationVersion("1.0")

    qt.setOrganizationName("MMT Temporary Services")
    qt.setOrganizationDomain("http://www.mmt-temp-srvs.com")

    c = Controller()
    qt.exec_()
def get_main_window_app(qt_from='pyqt', no_dark=True):
    """Return main window application."""

    # set log for debug
    logging.basicConfig(level=logging.DEBUG)

    style = ''

    if qt_from == 'pyside':
        # using PySide wrapper
        from PySide.QtGui import QApplication, QMainWindow, QDockWidget
        from PySide.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # getting style
        style = qdarkstyle.load_stylesheet_pyside()

    elif qt_from == 'pyqt':
        # using PyQt4 wrapper
        from PyQt4.QtGui import QApplication, QMainWindow, QDockWidget
        from PyQt4.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # getting style
        style = qdarkstyle.load_stylesheet_pyqt()

    elif qt_from == 'pyqt5':
        # using PyQt5 wrapper
        from PyQt5.QtWidgets import QApplication, QMainWindow, QDockWidget
        from PyQt5.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # getting style
        style = qdarkstyle.load_stylesheet_pyqt5()

    elif qt_from == 'qtpy':
        # using QtPy API
        from qtpy.QtWidgets import QApplication, QMainWindow, QDockWidget
        from qtpy.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # getting style
        style = qdarkstyle.load_stylesheet_from_environment()

    elif qt_from == 'pyqtgraph':
        # using PyQtGraph API
        from pyqtgraph.Qt import QtGui, QtCore
        # getting style
        style = qdarkstyle.load_stylesheet_from_environment(is_pyqtgraph=True)

    if no_dark:
        style = ''

    # create the application
    app = QApplication(sys.argv)
    app.setOrganizationName('QDarkStyle')
    app.setApplicationName('QDarkStyle Test')
    # setup stylesheet
    app.setStyleSheet(style)
    # create main window
    window = QMainWindow()
    window.setWindowTitle("QDarkStyle v." + qdarkstyle.__version__ +
                          " - TEST - Using " + qt_from)
    # auto quit after 2s when testing on travis-ci
    if "--test" in sys.argv:
        QTimer.singleShot(2000, app.exit)
    # run
    window.showMaximized()
    app.exec_()

    return window
Ejemplo n.º 14
0
    Pipes all exceptions to the logger, then lets the exceptions continue on
    their normal way.

    @param value: An exception
    @type value: Exception

    @param tback: The Traceback
    @type tback: Traceback
    """
    # log the exception
    tbackString = traceback.format_list(traceback.extract_tb(tback))
    logging.exception("\nAn exception occurred: %s\nTraceback: %s" % (value, tbackString))

    # then call the default handler
    sys.__excepthook__(type, value, tback)


if __name__ == "__main__":
    sys.excepthook = my_excepthook  # catch all exceptions for the logger

    app = QApplication(sys.argv)
    # set some info, just to be thorough (this stuff is mainly set in BioParkinController or the Ui_MainWindow itself).
    app.setOrganizationName("Zuse Institute Berlin")
    app.setOrganizationDomain("zib.de")
    app.setApplicationName("BioPARKIN")

    parkin = BioParkinController(sys.argv)
    parkin.show()

    app.exec_()
Ejemplo n.º 15
0
import os
import sys

from PySide.QtGui import QApplication
from PySide.QtGui import QIcon

from PySide.QtCore import QTranslator
from PySide.QtCore import QLocale
from PySide.QtCore import QLibraryInfo
from PySide.QtCore import Qt

from qrmainwindow import QtReduceMainWindow

app = QApplication(sys.argv)

app.setOrganizationName("The Reduce Project")
app.setOrganizationDomain("reduce-algebra.sourceforge.net")
app.setApplicationName("QReduce")

qtTranslator = QTranslator(app)
qtTranslator.load("qt_" + QLocale.system().name(),
                  QLibraryInfo.location(QLibraryInfo.TranslationsPath))
app.installTranslator(qtTranslator)

qreduceTranslator = QTranslator(app)
qreduceTranslator.load(sys.path[0] + "/" + "qreducetr." +
                       str(locale.getdefaultlocale()[0]))
#app.installTranslator(qreduceTranslator)

# app.setStyleSheet("QStatusBar::item { border: 0px solid black }");
Ejemplo n.º 16
0
Archivo: gui.py Proyecto: r3/r3tagger
        selectedDir = QFileDialog.getExistingDirectory(parent=self, caption="Add Album")

        self.addPath(selectedDir)

    def editRecognize(self):
        pass

    def editReorganize(self):
        pass

    def editSettings(self):
        pass

    def helpDocs(self):
        pass

    def helpAbout(self):
        pass


if __name__ == "__main__":
    app = QApplication(sys.argv)
    app.setOrganizationName("r3")
    app.setOrganizationDomain("github.com/r3")
    app.setApplicationName("r3tagger")

    form = MainWindow()
    form.show()

    sys.exit(app.exec_())
Ejemplo n.º 17
0
def main():
    """Execute QDarkStyle example."""
    parser = argparse.ArgumentParser(description=__doc__,
                                     formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument('--qt_from', default='qtpy',
                        choices=['pyqt', 'pyqt5', 'pyside','pyside2', 'qtpy', 'pyqtgraph'],
                        help="Choose which wrapper/framework is to be used to run the example.", type=str)
    parser.add_argument('--no_dark', action='store_true',
                        help="Exihibts the original  window (without qdarkstyle).")
    parser.add_argument('--test', action='store_true',
                        help="Auto close window after 2s.")
    parser.add_argument('--reset', action='store_true',
                        help="Reset GUI settings (position, size).")
    parser.add_argument('--screenshots', action='store_true',
                        help="Generate screenshots.")


    # parsing arguments from command line
    args = parser.parse_args()

    # set log for debug
    logging.basicConfig(level=logging.DEBUG)

    # to avoid problems when testing without screen
    if args.test:
        os.environ['QT_QPA_PLATFORM']='offscreen'

    if args.qt_from == 'pyside':
        # using PySide wrapper
        from PySide.QtGui import QApplication, QMainWindow, QDockWidget, QStatusBar, QLabel, QPushButton
        from PySide.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # import examples UI according to wrapper
        from ui.mw_menus_pyside_ui import Ui_MainWindow as ui_main

        from ui.dw_buttons_pyside_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_pyside_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_pyside_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_pyside_ui import Ui_DockWidget as ui_inputs_no_fields

        from ui.dw_widgets_pyside_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_pyside_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_pyside_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_pyside_ui import Ui_DockWidget as ui_containers_no_tabs

        # Getting style
        style_method = qdarkstyle.load_stylesheet_pyside

    elif args.qt_from == 'pyqt':
        # using PyQt4 wrapper
        from PyQt4.QtGui import QApplication, QMainWindow, QDockWidget, QStatusBar, QLabel, QPushButton
        from PyQt4.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # import examples UI according to wrapper
        from ui.mw_menus_pyqt_ui import Ui_MainWindow as ui_main

        from ui.dw_buttons_pyqt_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_pyqt_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_pyqt_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_pyqt_ui import Ui_DockWidget as ui_inputs_no_fields

        from ui.dw_widgets_pyqt_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_pyqt_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_pyqt_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_pyqt_ui import Ui_DockWidget as ui_containers_no_tabs

        # Getting style
        style_method = qdarkstyle.load_stylesheet_pyqt

    elif args.qt_from == 'pyqt5':
        # using PyQt5 wrapper
        from PyQt5.QtWidgets import QApplication, QMainWindow, QDockWidget, QStatusBar, QLabel, QPushButton
        from PyQt5.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # import examples UI according to wrapper
        from ui.mw_menus_pyqt5_ui import Ui_MainWindow as ui_main

        from ui.dw_buttons_pyqt5_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_pyqt5_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_pyqt5_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_pyqt5_ui import Ui_DockWidget as ui_inputs_no_fields

        from ui.dw_widgets_pyqt5_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_pyqt5_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_pyqt5_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_pyqt5_ui import Ui_DockWidget as ui_containers_no_tabs

        # Getting style
        style_method = qdarkstyle.load_stylesheet_pyqt5

    elif args.qt_from == 'pyside2':
        # using PyQt5 wrapper
        from PySide2.QtWidgets import QApplication, QMainWindow, QDockWidget, QStatusBar, QLabel, QPushButton
        from PySide2.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # import examples UI according to wrapper
        from ui.mw_menus_pyside2_ui import Ui_MainWindow as ui_main

        from ui.dw_buttons_pyside2_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_pyside2_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_pyside2_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_pyside2_ui import Ui_DockWidget as ui_inputs_no_fields

        from ui.dw_widgets_pyside2_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_pyside2_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_pyside2_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_pyside2_ui import Ui_DockWidget as ui_containers_no_tabs

        # Getting style
        style_method = qdarkstyle.load_stylesheet_pyside2

    elif args.qt_from == 'qtpy':
        # using QtPy API
        from qtpy.QtWidgets import QApplication, QMainWindow, QDockWidget, QStatusBar, QLabel, QPushButton
        from qtpy.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # import examples UI according to wrapper
        from ui.mw_menus_qtpy_ui import Ui_MainWindow as ui_main

        from ui.dw_buttons_qtpy_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_qtpy_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_qtpy_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_qtpy_ui import Ui_DockWidget as ui_inputs_no_fields

        from ui.dw_widgets_qtpy_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_qtpy_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_qtpy_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_qtpy_ui import Ui_DockWidget as ui_containers_no_tabs

        # Getting style
        style_method = qdarkstyle.load_stylesheet_from_environment

    elif args.qt_from == 'pyqtgraph':
        # using PyQtGraph API
        from pyqtgraph.Qt.QtGui import QApplication, QMainWindow, QDockWidget, QStatusBar, QLabel, QPushButton
        from pyqtgraph.Qt.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        #from pyqtgraph.Qt import QtGui, QtCore
        # import examples UI according to wrapper
        from ui.mw_menus_pyqtgraph_ui import Ui_MainWindow as ui_main
        from ui.dw_buttons_pyqtgraph_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_pyqtgraph_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_pyqtgraph_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_pyqtgraph_ui import Ui_DockWidget as ui_inputs_no_fields
        from ui.dw_widgets_pyqtgraph_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_pyqtgraph_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_pyqtgraph_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_pyqtgraph_ui import Ui_DockWidget as ui_containers_no_tabs

        # Getting style
        style_method = lambda: qdarkstyle.load_stylesheet_from_environment(is_pyqtgraph=True)

    if args.no_dark:
        style = ''

    def write_settings(window):
        """Get window settings and write it into a file."""
        settings = QSettings('QDarkStyle', 'QDarkStyle Example')
        settings.setValue('pos', window.pos())
        settings.setValue('size', window.size())
        settings.setValue('state', window.saveState())

    def read_settings(window, reset=False):
        """Read and set window settings from a file."""
        settings = QSettings('QDarkStyle', 'QDarkStyle Example')
        if args.qt_from == 'pyside' or args.qt_from == 'pyside2':
            pos = settings.value('pos', window.pos())
            size = settings.value('size', window.size())
            state = settings.value('state', window.saveState())
        else:
            pos = settings.value('pos', window.pos(), type='QPoint')
            size = settings.value('size', window.size(), type='QSize')
            state = settings.value('state', window.saveState(), type='QByteArray')

        if not reset:
            window.restoreState(state)
            window.resize(size)
            window.move(pos)

    # create the application
    app = QApplication(sys.argv)
    app.setOrganizationName('QDarkStyle')
    app.setApplicationName('QDarkStyle Example')

    # setup stylesheet
    style = style_method()
    app.setStyleSheet(style)

    # create main window
    window = QMainWindow()
    window.setObjectName('mainwindow')
    ui = ui_main()
    ui.setupUi(window)
    window.setWindowTitle("QDarkStyle v." + qdarkstyle.__version__)

    # create docks for buttons
    dw_buttons = QDockWidget()
    dw_buttons.setObjectName('buttons')
    ui_buttons = ui_buttons()
    ui_buttons.setupUi(dw_buttons)
    window.addDockWidget(Qt.RightDockWidgetArea, dw_buttons)

    # create docks for buttons
    dw_displays = QDockWidget()
    dw_displays.setObjectName('displays')
    ui_displays = ui_displays()
    ui_displays.setupUi(dw_displays)
    window.addDockWidget(Qt.RightDockWidgetArea, dw_displays)

    # create docks for inputs - no fields
    dw_inputs_no_fields = QDockWidget()
    dw_inputs_no_fields.setObjectName('inputs_no_fields')
    ui_inputs_no_fields = ui_inputs_no_fields()
    ui_inputs_no_fields.setupUi(dw_inputs_no_fields)
    window.addDockWidget(Qt.RightDockWidgetArea, dw_inputs_no_fields)

    # create docks for inputs - fields
    dw_inputs_fields = QDockWidget()
    dw_inputs_fields.setObjectName('_fields')
    ui_inputs_fields = ui_inputs_fields()
    ui_inputs_fields.setupUi(dw_inputs_fields)
    window.addDockWidget(Qt.RightDockWidgetArea, dw_inputs_fields)

    # create docks for widgets
    dw_widgets = QDockWidget()
    dw_widgets.setObjectName('widgets')
    ui_widgets = ui_widgets()
    ui_widgets.setupUi(dw_widgets)
    window.addDockWidget(Qt.LeftDockWidgetArea, dw_widgets)

    # create docks for views
    dw_views = QDockWidget()
    dw_views.setObjectName('views')
    ui_views = ui_views()
    ui_views.setupUi(dw_views)
    window.addDockWidget(Qt.LeftDockWidgetArea, dw_views)

    # create docks for containers - no tabs
    dw_containers_no_tabs = QDockWidget()
    dw_containers_no_tabs.setObjectName('containers_no_tabs')
    ui_containers_no_tabs = ui_containers_no_tabs()
    ui_containers_no_tabs.setupUi(dw_containers_no_tabs)
    window.addDockWidget(Qt.LeftDockWidgetArea, dw_containers_no_tabs)

    # create docks for containters - tabs
    dw_containers_tabs = QDockWidget()
    dw_containers_tabs.setObjectName('containers')
    ui_containers_tabs = ui_containers_tabs()
    ui_containers_tabs.setupUi(dw_containers_tabs)
    window.addDockWidget(Qt.LeftDockWidgetArea, dw_containers_tabs)

    # tabify right docks
    window.tabifyDockWidget(dw_buttons, dw_displays)
    window.tabifyDockWidget(dw_displays, dw_inputs_fields)
    window.tabifyDockWidget(dw_inputs_fields, dw_inputs_no_fields)

    # tabify right docks
    window.tabifyDockWidget(dw_containers_no_tabs, dw_containers_tabs)
    window.tabifyDockWidget(dw_containers_tabs, dw_widgets)
    window.tabifyDockWidget(dw_widgets, dw_views)

    # issues #9120, #9121 on Spyder
    qstatusbar = QStatusBar()
    qstatusbar.addWidget(QLabel('Issue Spyder #9120, #9121 - background not matching.'))
    qstatusbar.addWidget(QPushButton('OK'))
    window.setStatusBar(qstatusbar)

    # auto quit after 2s when testing on travis-ci
    if args.test:
        QTimer.singleShot(2000, app.exit)

    # run
    read_settings(window, args.reset)
    window.showMaximized()

    # Save screenshots for differents displays and quit
    if args.screenshots:
        window.showFullScreen()
        QTimer.singleShot(1000, lambda: create_screenshots(app, window, not args.no_dark))

    app.exec_()
    write_settings(window)
Ejemplo n.º 18
0
def main():
    """Execute QDarkStyle example."""
    parser = argparse.ArgumentParser(
        description=__doc__,
        formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument(
        '--qt_from',
        default='qtpy',
        choices=['pyqt', 'pyqt5', 'pyside', 'pyside2', 'qtpy', 'pyqtgraph'],
        help="Choose which wrapper/framework is to be used to run the example.",
        type=str)
    parser.add_argument(
        '--no_dark',
        action='store_true',
        help="Exihibts the original  window (without qdarkstyle).")
    parser.add_argument('--test',
                        action='store_true',
                        help="Auto close window after 2s.")
    parser.add_argument('--reset',
                        action='store_true',
                        help="Reset GUI settings (position, size).")
    parser.add_argument('--screenshots',
                        action='store_true',
                        help="Generate screenshots.")

    # parsing arguments from command line
    args = parser.parse_args()

    # set log for debug
    logging.basicConfig(level=logging.DEBUG)

    # to avoid problems when testing without screen
    if args.test:
        os.environ['QT_QPA_PLATFORM'] = 'offscreen'

    if args.qt_from == 'pyside':
        # using PySide wrapper
        from PySide.QtGui import QApplication, QMainWindow, QDockWidget, QStatusBar, QLabel, QPushButton
        from PySide.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # import examples UI according to wrapper
        from ui.mw_menus_pyside_ui import Ui_MainWindow as ui_main

        from ui.dw_buttons_pyside_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_pyside_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_pyside_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_pyside_ui import Ui_DockWidget as ui_inputs_no_fields

        from ui.dw_widgets_pyside_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_pyside_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_pyside_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_pyside_ui import Ui_DockWidget as ui_containers_no_tabs

        # Getting style
        style_method = qdarkstyle.load_stylesheet_pyside

    elif args.qt_from == 'pyqt':
        # using PyQt4 wrapper
        from PyQt4.QtGui import QApplication, QMainWindow, QDockWidget, QStatusBar, QLabel, QPushButton
        from PyQt4.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # import examples UI according to wrapper
        from ui.mw_menus_pyqt_ui import Ui_MainWindow as ui_main

        from ui.dw_buttons_pyqt_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_pyqt_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_pyqt_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_pyqt_ui import Ui_DockWidget as ui_inputs_no_fields

        from ui.dw_widgets_pyqt_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_pyqt_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_pyqt_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_pyqt_ui import Ui_DockWidget as ui_containers_no_tabs

        # Getting style
        style_method = qdarkstyle.load_stylesheet_pyqt

    elif args.qt_from == 'pyqt5':
        # using PyQt5 wrapper
        from PyQt5.QtWidgets import QApplication, QMainWindow, QDockWidget, QStatusBar, QLabel, QPushButton
        from PyQt5.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # import examples UI according to wrapper
        from ui.mw_menus_pyqt5_ui import Ui_MainWindow as ui_main

        from ui.dw_buttons_pyqt5_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_pyqt5_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_pyqt5_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_pyqt5_ui import Ui_DockWidget as ui_inputs_no_fields

        from ui.dw_widgets_pyqt5_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_pyqt5_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_pyqt5_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_pyqt5_ui import Ui_DockWidget as ui_containers_no_tabs

        # Getting style
        style_method = qdarkstyle.load_stylesheet_pyqt5

    elif args.qt_from == 'pyside2':
        # using PyQt5 wrapper
        from PySide2.QtWidgets import QApplication, QMainWindow, QDockWidget, QStatusBar, QLabel, QPushButton
        from PySide2.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # import examples UI according to wrapper
        from ui.mw_menus_pyside2_ui import Ui_MainWindow as ui_main

        from ui.dw_buttons_pyside2_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_pyside2_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_pyside2_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_pyside2_ui import Ui_DockWidget as ui_inputs_no_fields

        from ui.dw_widgets_pyside2_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_pyside2_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_pyside2_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_pyside2_ui import Ui_DockWidget as ui_containers_no_tabs

        # Getting style
        style_method = qdarkstyle.load_stylesheet_pyside2

    elif args.qt_from == 'qtpy':
        # using QtPy API
        from qtpy.QtWidgets import QApplication, QMainWindow, QDockWidget, QStatusBar, QLabel, QPushButton
        from qtpy.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # import examples UI according to wrapper
        from ui.mw_menus_qtpy_ui import Ui_MainWindow as ui_main

        from ui.dw_buttons_qtpy_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_qtpy_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_qtpy_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_qtpy_ui import Ui_DockWidget as ui_inputs_no_fields

        from ui.dw_widgets_qtpy_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_qtpy_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_qtpy_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_qtpy_ui import Ui_DockWidget as ui_containers_no_tabs

        # Getting style
        style_method = qdarkstyle.load_stylesheet_from_environment

    elif args.qt_from == 'pyqtgraph':
        # using PyQtGraph API
        from pyqtgraph.Qt.QtGui import QApplication, QMainWindow, QDockWidget, QStatusBar, QLabel, QPushButton
        from pyqtgraph.Qt.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        #from pyqtgraph.Qt import QtGui, QtCore
        # import examples UI according to wrapper
        from ui.mw_menus_pyqtgraph_ui import Ui_MainWindow as ui_main
        from ui.dw_buttons_pyqtgraph_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_pyqtgraph_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_pyqtgraph_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_pyqtgraph_ui import Ui_DockWidget as ui_inputs_no_fields
        from ui.dw_widgets_pyqtgraph_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_pyqtgraph_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_pyqtgraph_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_pyqtgraph_ui import Ui_DockWidget as ui_containers_no_tabs

        # Getting style
        style_method = lambda: qdarkstyle.load_stylesheet_from_environment(
            is_pyqtgraph=True)

    def write_settings(window):
        """Get window settings and write it into a file."""
        settings = QSettings('QDarkStyle', 'QDarkStyle Example')
        settings.setValue('pos', window.pos())
        settings.setValue('size', window.size())
        settings.setValue('state', window.saveState())

    def read_settings(window, reset=False):
        """Read and set window settings from a file."""
        settings = QSettings('QDarkStyle', 'QDarkStyle Example')

        try:
            pos = settings.value('pos', window.pos())
            size = settings.value('size', window.size())
            state = settings.value('state', window.saveState())
        except Exception:
            pos = settings.value('pos', window.pos(), type='QPoint')
            size = settings.value('size', window.size(), type='QSize')
            state = settings.value('state',
                                   window.saveState(),
                                   type='QByteArray')

        if not reset:
            window.restoreState(state)
            window.resize(size)
            window.move(pos)

    # create the application
    app = QApplication(sys.argv)
    app.setOrganizationName('QDarkStyle')
    app.setApplicationName('QDarkStyle Example')

    # setup stylesheet
    style = ''

    if args.no_dark is False:
        style = style_method()

    app.setStyleSheet(style)

    # create main window
    window = QMainWindow()
    window.setObjectName('mainwindow')
    ui = ui_main()
    ui.setupUi(window)
    window.setWindowTitle("QDarkStyle v." + qdarkstyle.__version__)

    # create docks for buttons
    dw_buttons = QDockWidget()
    dw_buttons.setObjectName('buttons')
    ui_buttons = ui_buttons()
    ui_buttons.setupUi(dw_buttons)
    window.addDockWidget(Qt.RightDockWidgetArea, dw_buttons)

    # create docks for buttons
    dw_displays = QDockWidget()
    dw_displays.setObjectName('displays')
    ui_displays = ui_displays()
    ui_displays.setupUi(dw_displays)
    window.addDockWidget(Qt.RightDockWidgetArea, dw_displays)

    # create docks for inputs - no fields
    dw_inputs_no_fields = QDockWidget()
    dw_inputs_no_fields.setObjectName('inputs_no_fields')
    ui_inputs_no_fields = ui_inputs_no_fields()
    ui_inputs_no_fields.setupUi(dw_inputs_no_fields)
    window.addDockWidget(Qt.RightDockWidgetArea, dw_inputs_no_fields)

    # create docks for inputs - fields
    dw_inputs_fields = QDockWidget()
    dw_inputs_fields.setObjectName('_fields')
    ui_inputs_fields = ui_inputs_fields()
    ui_inputs_fields.setupUi(dw_inputs_fields)
    window.addDockWidget(Qt.RightDockWidgetArea, dw_inputs_fields)

    # create docks for widgets
    dw_widgets = QDockWidget()
    dw_widgets.setObjectName('widgets')
    ui_widgets = ui_widgets()
    ui_widgets.setupUi(dw_widgets)
    window.addDockWidget(Qt.LeftDockWidgetArea, dw_widgets)

    # create docks for views
    dw_views = QDockWidget()
    dw_views.setObjectName('views')
    ui_views = ui_views()
    ui_views.setupUi(dw_views)
    window.addDockWidget(Qt.LeftDockWidgetArea, dw_views)

    # create docks for containers - no tabs
    dw_containers_no_tabs = QDockWidget()
    dw_containers_no_tabs.setObjectName('containers_no_tabs')
    ui_containers_no_tabs = ui_containers_no_tabs()
    ui_containers_no_tabs.setupUi(dw_containers_no_tabs)
    window.addDockWidget(Qt.LeftDockWidgetArea, dw_containers_no_tabs)

    # create docks for containters - tabs
    dw_containers_tabs = QDockWidget()
    dw_containers_tabs.setObjectName('containers')
    ui_containers_tabs = ui_containers_tabs()
    ui_containers_tabs.setupUi(dw_containers_tabs)
    window.addDockWidget(Qt.LeftDockWidgetArea, dw_containers_tabs)

    # tabify right docks
    window.tabifyDockWidget(dw_buttons, dw_displays)
    window.tabifyDockWidget(dw_displays, dw_inputs_fields)
    window.tabifyDockWidget(dw_inputs_fields, dw_inputs_no_fields)

    # tabify right docks
    window.tabifyDockWidget(dw_containers_no_tabs, dw_containers_tabs)
    window.tabifyDockWidget(dw_containers_tabs, dw_widgets)
    window.tabifyDockWidget(dw_widgets, dw_views)

    # issues #9120, #9121 on Spyder
    qstatusbar = QStatusBar()
    qstatusbar.addWidget(
        QLabel('Issue Spyder #9120, #9121 - background not matching.'))
    qstatusbar.addWidget(QPushButton('OK'))
    window.setStatusBar(qstatusbar)

    # auto quit after 2s when testing on travis-ci
    if args.test:
        QTimer.singleShot(2000, app.exit)

    # run
    read_settings(window, args.reset)
    window.showMaximized()

    # Save screenshots for differents displays and quit
    if args.screenshots:
        window.showFullScreen()
        QTimer.singleShot(
            1000, lambda: create_screenshots(app, window, not args.no_dark))

    app.exec_()
    write_settings(window)
Ejemplo n.º 19
0
    @param tback: The Traceback
    @type tback: Traceback
    """
    # log the exception 
    tbackString = traceback.format_list(traceback.extract_tb(tback))
    logging.exception("\nAn exception occurred: %s\nTraceback: %s" % (value,
                                                                      tbackString))

    # then call the default handler
    sys.__excepthook__(type, value, tback)


if __name__ == '__main__':
    sys.excepthook = my_excepthook  # catch all exceptions for the logger

    app = QApplication(sys.argv)
    #set some info, just to be thorough (this stuff is mainly set in BioParkinController or the Ui_MainWindow itself).
    app.setOrganizationName("Zuse Institute Berlin")
    app.setOrganizationDomain("zib.de")
    app.setApplicationName("BioPARKIN")

    parkin = BioParkinController(sys.argv)
    parkin.show()

    app.exec_()

    #cProfile.run('app.exec_()')


Ejemplo n.º 20
0
		layout.addWidget(self.lineEdit,0,1)
		layout.addWidget(self.updateButton,0,2)
		layout.addWidget(self.autoUpdate,1,1,1,2)
		layout.addWidget(responseLabel,2,0)
		layout.addWidget(self.responseLabel,2,1,1,2)
		layout.addWidget(self.tableWidget,3,0,1,3)
		layout.addWidget(progressLabel,4,0)
		layout.addWidget(self.progressView,5,0,1,3)
		layout.addWidget(self.aboutButton,6,2)
		self.setLayout(layout)
	
	def closeEvent(self,event):
		self.thread.quit()
		self.thread.wait()
		event.accept()
	
	def keyPressEvent(self,event):
		if event.key() == Qt.Key_Escape:
			self.thread.calculator.progress.abort()
			event.accept()
		else:
			event.ignore()

app=QApplication(sys.argv)
app.setOrganizationName("Peter Waldert")
app.setApplicationName("SymbolWorte")
app.setApplicationVersion("v0.3")
f=SymbolWort()
f.show()
sys.exit(app.exec_())
Ejemplo n.º 21
0
import krait_rc

#from PySide2.QtCore import Qt, QCoreApplication
#from PySide2.QtGui import QPixmap, QFont, QFontDatabase
#from PySide2.QtWidgets import QApplication, QSplashScreen
from PySide.QtCore import Qt, QCoreApplication
from PySide.QtGui import QPixmap, QFont, QFontDatabase, QApplication, QSplashScreen

#create application and set properties

if __name__ == '__main__':
    #QCoreApplication.setAttribute(Qt.AA_ShareOpenGLContexts)
    #QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling)

    app = QApplication(sys.argv)
    app.setOrganizationName('Bioinformatics and Integrative Genomics')
    app.setOrganizationDomain('http://big.cdu.edu.cn')
    app.setApplicationName('Krait')

    #set font family
    QFontDatabase.addApplicationFont(":/fonts/roboto.ttf")

    #support windows 7, 10 taskbar icon
    import ctypes
    if os.name == 'nt':
        myappid = 'BIG.Krait.ssr.1.0'
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)

    splash_img = QPixmap(":/icons/splash.png")
    splash = QSplashScreen(splash_img)
    splash.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.SplashScreen
Ejemplo n.º 22
0
def main():
    """Execute QDarkStyle example."""
    parser = argparse.ArgumentParser(
        description=__doc__,
        formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument(
        '--qt_from',
        default='pyqt',
        choices=['pyqt', 'pyqt5', 'pyside', 'qtpy', 'pyqtgraph'],
        help="Choose which wrapper/framework is to be used to run the example.",
        type=str)
    parser.add_argument(
        '--no_dark',
        action='store_true',
        help="Exihibts the original  window (without qdarkstyle).")
    parser.add_argument('--test',
                        action='store_true',
                        help="Auto close window after 2s.")
    # parsing arguments from command line
    args = parser.parse_args()

    # set log for debug
    logging.basicConfig(level=logging.DEBUG)

    if args.qt_from == 'pyside':
        # using PySide wrapper
        from PySide.QtGui import QApplication, QMainWindow, QDockWidget
        from PySide.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # import examples UI according to wrapper
        from ui.mw_menus_pyside_ui import Ui_MainWindow as ui_main

        from ui.dw_buttons_pyside_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_pyside_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_pyside_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_pyside_ui import Ui_DockWidget as ui_inputs_no_fields

        from ui.dw_widgets_pyside_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_pyside_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_pyside_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_pyside_ui import Ui_DockWidget as ui_containers_no_tabs
        # getting style
        style = qdarkstyle.load_stylesheet_pyside()

    elif args.qt_from == 'pyqt':
        # using PyQt4 wrapper
        from PyQt4.QtGui import QApplication, QMainWindow, QDockWidget
        from PyQt4.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # import examples UI according to wrapper
        from ui.mw_menus_pyqt_ui import Ui_MainWindow as ui_main

        from ui.dw_buttons_pyqt_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_pyqt_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_pyqt_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_pyqt_ui import Ui_DockWidget as ui_inputs_no_fields

        from ui.dw_widgets_pyqt_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_pyqt_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_pyqt_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_pyqt_ui import Ui_DockWidget as ui_containers_no_tabs
        # getting style
        style = qdarkstyle.load_stylesheet_pyqt()

    elif args.qt_from == 'pyqt5':
        # using PyQt5 wrapper
        from PyQt5.QtWidgets import QApplication, QMainWindow, QDockWidget
        from PyQt5.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # import examples UI according to wrapper
        from ui.mw_menus_pyqt5_ui import Ui_MainWindow as ui_main

        from ui.dw_buttons_pyqt5_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_pyqt5_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_pyqt5_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_pyqt5_ui import Ui_DockWidget as ui_inputs_no_fields

        from ui.dw_widgets_pyqt5_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_pyqt5_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_pyqt5_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_pyqt5_ui import Ui_DockWidget as ui_containers_no_tabs
        # getting style
        style = qdarkstyle.load_stylesheet_pyqt5()

    elif args.qt_from == 'qtpy':
        # using QtPy API
        from qtpy.QtWidgets import QApplication, QMainWindow, QDockWidget
        from qtpy.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        # import examples UI according to wrapper
        from ui.mw_menus_qtpy_ui import Ui_MainWindow as ui_main

        from ui.dw_buttons_qtpy_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_qtpy_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_qtpy_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_qtpy_ui import Ui_DockWidget as ui_inputs_no_fields

        from ui.dw_widgets_qtpy_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_qtpy_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_qtpy_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_qtpy_ui import Ui_DockWidget as ui_containers_no_tabs
        # getting style
        style = qdarkstyle.load_stylesheet_from_environment()

    elif args.qt_from == 'pyqtgraph':
        # using PyQtGraph API
        from pyqtgraph.Qt.QtGui import QApplication, QMainWindow, QDockWidget
        from pyqtgraph.Qt.QtCore import QTimer, Qt, QSettings, QByteArray, QPoint, QSize
        #from pyqtgraph.Qt import QtGui, QtCore
        # import examples UI according to wrapper
        from ui.mw_menus_pyqtgraph_ui import Ui_MainWindow as ui_main
        from ui.dw_buttons_pyqtgraph_ui import Ui_DockWidget as ui_buttons
        from ui.dw_displays_pyqtgraph_ui import Ui_DockWidget as ui_displays
        from ui.dw_inputs_fields_pyqtgraph_ui import Ui_DockWidget as ui_inputs_fields
        from ui.dw_inputs_no_fields_pyqtgraph_ui import Ui_DockWidget as ui_inputs_no_fields
        from ui.dw_widgets_pyqtgraph_ui import Ui_DockWidget as ui_widgets
        from ui.dw_views_pyqtgraph_ui import Ui_DockWidget as ui_views
        from ui.dw_containers_tabs_pyqtgraph_ui import Ui_DockWidget as ui_containers_tabs
        from ui.dw_containers_no_tabs_pyqtgraph_ui import Ui_DockWidget as ui_containers_no_tabs
        # getting style
        style = qdarkstyle.load_stylesheet_from_environment(is_pyqtgraph=True)

    if args.no_dark:
        style = ''

    def write_settings(window):
        """Get window settings and write it into a file."""
        settings = QSettings('QDarkStyle', 'QDarkStyle Example')
        settings.setValue('pos', window.pos())
        settings.setValue('size', window.size())
        settings.setValue('state', window.saveState())

    def read_settings(window):
        """Read and set window settings from a file."""
        settings = QSettings('QDarkStyle', 'QDarkStyle Example')
        if args.qt_from == 'pyside':
            pos = settings.value('pos', window.pos())
            size = settings.value('size', window.size())
            state = settings.value('state', window.saveState())
        else:
            pos = settings.value('pos', window.pos(), type='QPoint')
            size = settings.value('size', window.size(), type='QSize')
            state = settings.value('state',
                                   window.saveState(),
                                   type='QByteArray')
        window.restoreState(state)
        window.resize(size)
        window.move(pos)

    # create the application
    app = QApplication(sys.argv)
    app.setOrganizationName('QDarkStyle')
    app.setApplicationName('QDarkStyle Example')

    # setup stylesheet
    app.setStyleSheet(style)

    # create main window
    window = QMainWindow()
    window.setObjectName('mainwindow')
    ui = ui_main()
    ui.setupUi(window)
    window.setWindowTitle("QDarkStyle v." + qdarkstyle.__version__ +
                          " - Example - Using " + args.qt_from)

    # create docks for buttons
    dw_buttons = QDockWidget()
    dw_buttons.setObjectName('buttons')
    ui_buttons = ui_buttons()
    ui_buttons.setupUi(dw_buttons)
    window.addDockWidget(Qt.RightDockWidgetArea, dw_buttons)

    # create docks for buttons
    dw_displays = QDockWidget()
    dw_displays.setObjectName('displays')
    ui_displays = ui_displays()
    ui_displays.setupUi(dw_displays)
    window.addDockWidget(Qt.RightDockWidgetArea, dw_displays)

    # create docks for inputs - fields
    dw_inputs_fields = QDockWidget()
    dw_inputs_fields.setObjectName('_fields')
    ui_inputs_fields = ui_inputs_fields()
    ui_inputs_fields.setupUi(dw_inputs_fields)
    window.addDockWidget(Qt.RightDockWidgetArea, dw_inputs_fields)

    # create docks for inputs - no fields
    dw_inputs_no_fields = QDockWidget()
    dw_inputs_no_fields.setObjectName('inputs_no_fields')
    ui_inputs_no_fields = ui_inputs_no_fields()
    ui_inputs_no_fields.setupUi(dw_inputs_no_fields)
    window.addDockWidget(Qt.RightDockWidgetArea, dw_inputs_no_fields)

    # create docks for widgets
    dw_widgets = QDockWidget()
    dw_widgets.setObjectName('widgets')
    ui_widgets = ui_widgets()
    ui_widgets.setupUi(dw_widgets)
    window.addDockWidget(Qt.LeftDockWidgetArea, dw_widgets)

    # create docks for views
    dw_views = QDockWidget()
    dw_views.setObjectName('views')
    ui_views = ui_views()
    ui_views.setupUi(dw_views)
    window.addDockWidget(Qt.LeftDockWidgetArea, dw_views)

    # create docks for containters - tabs
    dw_containers_tabs = QDockWidget()
    dw_containers_tabs.setObjectName('containers')
    ui_containers_tabs = ui_containers_tabs()
    ui_containers_tabs.setupUi(dw_containers_tabs)
    window.addDockWidget(Qt.LeftDockWidgetArea, dw_containers_tabs)

    # create docks for containers - no tabs
    dw_containers_no_tabs = QDockWidget()
    dw_containers_no_tabs.setObjectName('containers_no_tabs')
    ui_containers_no_tabs = ui_containers_no_tabs()
    ui_containers_no_tabs.setupUi(dw_containers_no_tabs)
    window.addDockWidget(Qt.LeftDockWidgetArea, dw_containers_no_tabs)

    # tabify right docks
    window.tabifyDockWidget(dw_buttons, dw_displays)
    window.tabifyDockWidget(dw_displays, dw_inputs_fields)
    window.tabifyDockWidget(dw_inputs_fields, dw_inputs_no_fields)

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

    # run
    read_settings(window)
    window.showMaximized()
    app.exec_()
    write_settings(window)
Ejemplo n.º 23
0
        dateString = self.exerciseDateEdit.date().toString('yyyy-MM-dd')
        self.db.logExercise(dateString, exData[0], exData[1], exData[2], exData[3], exData[4])
        # reload model
        self.changeExerciseDate(self.exerciseDateEdit.date())
        
    def logExerciseClick(self):
        """
        Use the button to log the currently selected exercise to the currently
        selected day
        """
        if len(self.exerciseList.selectedIndexes()) != 0:
            QModelIndex = self.exerciseList.selectedIndexes()[0]
            self.logExercise(QModelIndex)
        
    def changeExerciseDate(self, date=QDate.currentDate()):
        """
        Actions to conduct when date is changed, e.g. check if date exists in
        database, load existing exercise log
        """
        
        self.exerciseLogModel = ExerciseLogModel(self.db, date, self)
        self.dailyExerciseLog.setModel(self.exerciseLogModel)
        
if __name__ == '__main__':
    app = QApplication(sys.argv)
    app.setOrganizationName('visrolia.net')
    app.setOrganizationDomain('visrolia.net')
    app.setApplicationName('Tracker')
    frame = MainWindow()
    frame.show()
    app.exec_()
Ejemplo n.º 24
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
#do not generate pyc file
sys.dont_write_bytecode = True

import splash_rc

from PySide.QtCore import Qt
from PySide.QtGui import QApplication, QSplashScreen, QPixmap

#create application and set properties
app = QApplication(sys.argv)
app.setOrganizationName('Chengdu University')
app.setOrganizationDomain('http://www.cdu.edu.cn')
app.setApplicationName('Krait')

#support windows 7, 10 taskbar icon
import ctypes
if os.name == 'nt':
    myappid = 'CDU.Krait.ssr.1.0'
    ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)

splash_img = QPixmap(":/icons/splash.png")
splash = QSplashScreen(splash_img)
splash.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.SplashScreen
                      | Qt.FramelessWindowHint)
splash.setStyleSheet('''
	font-family:"Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
	font-size: 14px;
Ejemplo n.º 25
0
        return os.system('dot_clean %s' % path)
    
    def siguienteClicked(self):
        if self.lista.currentItem():
            selected = self.lista.currentItem().text()
            path = os.path.join('/Volumes', selected)
            if self.dot_clean(path) == 0:
                title = 'Proceso exitoso'
                msg = u'Se limpió la memoria con éxito'
            else:
                title = 'Proceso fallido'
                msg = u'Ocurrió un error inesperado. Verifique que la memoria esté montada.'
        else:
            title = 'Proceso fallido'
            msg = u'No se encuentra ninguna memoria, por favor introduzca una y vuelva a iniciar la apliación'
        QMessageBox.information(self, title, msg)
        self.close()

if __name__ == '__main__':
    app = QApplication(sys.argv)
    app.setOrganizationName("ehmSoftware")
    app.setOrganizationDomain("ehmsoft.com")
    app.setApplicationName("Dot Clean")
    app.setWindowIcon(QIcon(":/images/icono.png"))
    ventana = GUIdot_cleanMac()
    ventana.show()
    ventana.raise_()
    sys.exit(app.exec_())


Ejemplo n.º 26
0
if __name__ == '__main__':
    import sys
    import Qrc  # noqa
    import HelpForm

    class FakeState:
        def __init__(self):
            self.window = None
            self.helpForm = None
            self.stdFontFamily = "Times New Roman"
            self.stdFontSize = 13

        def help(self, page=None):
            if self.helpForm is None:
                self.helpForm = HelpForm.Form("xix_help.html", self.window)
            if page is not None:
                self.helpForm.changePage(page)
            self.helpForm.show()
            self.helpForm.raise_()
            self.helpForm.activateWindow()

    app = QApplication([])
    app.setOrganizationName("Qtrac Ltd.")
    app.setOrganizationDomain("qtrac.eu")
    app.setApplicationName("XindeX-Test")
    app.setApplicationVersion("1.0.0")
    state = FakeState()
    form = Form(state)
    form.show()
    app.exec_()
        
        if not export_file:
            return

        include_solutions = self.mIncludeSolutions.isChecked()
        export_file = "{0}.xls".format(os.path.splitext(export_file)[0])
        _export_test_to_xls_file(self.test, export_file, include_solutions)

    def _on_edit_verbs_list(self):
        file_path = os.path.join(
            QDesktopServices.storageLocation(QDesktopServices.DataLocation), 
            VERBS_FILE)
        QDesktopServices.openUrl(QUrl.fromLocalFile(file_path))

    def _on_edit_export_style(self):
        file_path = os.path.join(
            QDesktopServices.storageLocation(QDesktopServices.DataLocation), 
            FORMAT_FILE)
        QDesktopServices.openUrl(QUrl.fromLocalFile(file_path))
        
        

if __name__ == '__main__':
    app = QApplication(sys.argv)
    app.setOrganizationName("TeacherTools")
    app.setApplicationName("IrregularVerbsTestGenerator")
    frame = MainWindow()
    frame.show()    
    app.exec_()