Example #1
0
def init(bootstrap_function):
    """
    Init gui.
    Concat all files from style directory and apply stylesheet.
    Run `bootstrap_function` to prepare app.
    """
    app = QApplication(sys.argv)
    app.setWindowIcon(QIcon(os.path.join(options.STATIC_DIR, 'splash.png')))
    splash_img = QPixmap(os.path.join(options.STATIC_DIR, 'splash.png'))
    splash = QSplashScreen(splash_img)
    splash.show()
    app.processEvents()

    items = bootstrap_function()

    style = []
    style_dir = os.path.join(options.STATIC_DIR, 'style')
    for f in os.listdir(style_dir):
        if not f.endswith('.qss'):
            continue
        with open(os.path.join(style_dir, f), 'r') as qss:
            style.append(qss.read())
    app.setStyleSheet('\n'.join(style))

    mw = MainWindow(items)
    splash.finish(mw)
    sys.exit(app.exec_())
Example #2
0
def main():
    """
    Main function for the program
    """
    parser = argparse.ArgumentParser(
        description="Loop a video between 2 points in time based on rules in "
                    "a text file."
    )
    parser.add_argument('timestamp_filename', metavar='F', nargs='?',
                        help='the location of the timestamp file')
    parser.add_argument('--video_filename', metavar='V',
                        help='the location of the video file')
    args = parser.parse_args()
    app = QApplication(sys.argv)
    with open("gui/application.qss", "r") as theme_file:
        app.setStyleSheet(theme_file.read())
    main_window = MainWindow()

    if args.timestamp_filename:
        timestamp_filename = os.path.abspath(args.timestamp_filename)
        main_window.set_timestamp_filename(timestamp_filename)
    if args.video_filename:
        video_filename = os.path.abspath(args.video_filename)
        main_window.set_video_filename(video_filename)

    sys.exit(app.exec_())
Example #3
0
def rock_and_roll():
    qsettings = QSettings(paths.SETTINGS, QSettings.IniFormat)
    qapp = QApplication(sys.argv)
    # Load components after qapp
    #lint:disable
    import amaru.ui.main_container
    import amaru.ui.status_bar
    import amaru.ui.lateral.tree_project
    import amaru.ui.lateral.lateral
    #lint:enable

    # StyleSheet
    log.debug("Aply style sheet...")
    with open(style, mode='r') as f:
        qapp.setStyleSheet(f.read())

    # Show GUI
    log.debug("Showing GUI...")
    gui = Amaru()
    gui.setMinimumSize(700, 500)
    gui.show()

    # Load tabs from last session
    tabs = qsettings.value("opened-tabs")
    if tabs is None:
        tabs = []
    gui.load_files(tabs)

    sys.exit(qapp.exec_())
Example #4
0
def main():
    # The app object is the application running on your computer.
    app = QApplication(sys.argv)
    app.setStyleSheet(load_stylesheet('puppy.css'))

    # A splash screen is a logo that appears when you start up the application.
    # The image to be "splashed" on your screen is in the resources/images
    # directory.
    splash = QSplashScreen(load_pixmap('splash'))
    # Show the splash.
    splash.show()

    # Make the editor with the Puppy class defined above.
    the_editor = Puppy()

    proj_root = os.path.join(ROOT, 'hello_world')
    proj = HelloWorld(proj_root, {})
    if not os.path.isdir(proj_root):
        proj.init_files()
    the_editor.add_project(proj)

    the_editor.show()
    the_editor.autosize_window()

    # Remove the splash when the_editor has finished setting itself up.
    splash.finish(the_editor)

    # Stop the program after application finishes executing.
    sys.exit(app.exec_())
Example #5
0
def main():
    app = QApplication(sys.argv)
    css = """
        Box {background: white;}
        QLineEdit {border: 1px solid #eee;height: 30px;}
    """
    app.setStyleSheet(css)
    w = Box()
    w.show()
    sys.exit(app.exec_())
Example #6
0
def main():
	if markups.__version_tuple__ < (2, ):
		sys.exit('Error: ReText needs PyMarkups 2.0 or newer to run.')

	# If we're running on Windows without a console, then discard stdout
	# and save stderr to a file to facilitate debugging in case of crashes.
	if sys.executable.endswith('pythonw.exe'):
		sys.stdout = open(devnull, 'w')
		sys.stderr = open('stderr.log', 'w')

	app = QApplication(sys.argv)
	app.setOrganizationName("ReText project")
	app.setApplicationName("ReText")
	app.setApplicationDisplayName("ReText")
	app.setApplicationVersion(app_version)
	app.setOrganizationDomain('mitya57.me')
	if hasattr(app, 'setDesktopFileName'): # available since Qt 5.7
		app.setDesktopFileName('me.mitya57.ReText.desktop')
	QNetworkProxyFactory.setUseSystemConfiguration(True)
	RtTranslator = QTranslator()
	for path in datadirs:
		if RtTranslator.load('retext_' + globalSettings.uiLanguage,
		                     join(path, 'locale')):
			break
	QtTranslator = QTranslator()
	QtTranslator.load("qt_" + globalSettings.uiLanguage,
		QLibraryInfo.location(QLibraryInfo.TranslationsPath))
	app.installTranslator(RtTranslator)
	app.installTranslator(QtTranslator)
	print('Using configuration file:', settings.fileName())
	if globalSettings.appStyleSheet:
		sheetfile = QFile(globalSettings.appStyleSheet)
		sheetfile.open(QIODevice.ReadOnly)
		app.setStyleSheet(QTextStream(sheetfile).readAll())
		sheetfile.close()
	window = ReTextWindow()
	window.show()
	# ReText can change directory when loading files, so we
	# need to have a list of canonical names before loading
	fileNames = list(map(canonicalize, sys.argv[1:]))
	previewMode = False
	for fileName in fileNames:
		if QFile.exists(fileName):
			window.openFileWrapper(fileName)
			if previewMode:
				window.actionPreview.setChecked(True)
				window.preview(True)
		elif fileName == '--preview':
			previewMode = True
	inputData = '' if (sys.stdin is None or sys.stdin.isatty()) else sys.stdin.read()
	if inputData or not window.tabWidget.count():
		window.createNew(inputData)
	signal.signal(signal.SIGINT, lambda sig, frame: window.close())
	sys.exit(app.exec())
Example #7
0
def main():
    import sys
    from PyQt5.QtWidgets import QApplication
    from controllers import PayrunController

    app = QApplication(sys.argv)
    ssh_file = 'views/allocat.stylesheet'
    with open(ssh_file, "r") as fh:
        app.setStyleSheet(fh.read())

    ctrlr = PayrunController()
    ctrlr.runit()
    sys.exit(app.exec_())
Example #8
0
def main():
    app = QApplication(sys.argv)
    mainWindow = MainWindow(app)
    print("data path:"+mainWindow.DataPath)
    print(mainWindow.param.skin)
    if(mainWindow.param.skin == 1) :# light skin
        file = open(mainWindow.DataPath+'/assets/qss/style.qss',"r")
    else: #elif mainWindow.param == 2: # dark skin
        file = open(mainWindow.DataPath + '/assets/qss/style-dark.qss', "r")
    qss = file.read().replace("$DataPath",mainWindow.DataPath)
    app.setStyleSheet(qss)
    mainWindow.detectSerialPort()
    t = threading.Thread(target=mainWindow.autoUpdateDetect)
    t.setDaemon(True)
    t.start()
    sys.exit(app.exec_())
def gui_mode():
    """
    Start NEFI2 GUI
    """
    extloader = ExtensionLoader()
    pipeline = Pipeline(extloader.cats_container, True)

    app = QApplication(sys.argv)

    app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
    app.setQuitOnLastWindowClosed(True)
    wnd = MainView(pipeline)
    wnd.load_dark_theme(app)
    wnd.show()

    sys.exit(app.exec_())
Example #10
0
def main():
    import sys

    # To help with quitting the application.
    # http://stackoverflow.com/questions/4938723/what-is-the-correct-way-to-make-my-pyqt-application-quit-when-killed-from-the-co/6072360#6072360
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    app = QApplication(sys.argv)

    # This gets rid of the border around the items in the status bar.
    # But I now see an error in the console "Could not parse application stylesheet"
    app.setStyleSheet("QStatusBar::item { border: 0px solid black }; ")

    window = MainWindow()
    window.show()

    sys.exit(app.exec_())
Example #11
0
    def gui_mode():
        """
        Start NEFI2 GUI
        """
        myappid = 'nefi2.0' # arbitrary string
        if sys.platform == 'win32' or sys.platform == 'win64':
            ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)

        extloader = ExtensionLoader()
        pipeline = Pipeline(extloader.cats_container)
        app = QApplication(sys.argv)
        app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
        app.setQuitOnLastWindowClosed(True)
        app.setWindowIcon(QtGui.QIcon(os.path.join('icons', 'nefi2.ico')))
        wnd = MainView(pipeline)
        wnd.load_dark_theme(app)
        wnd.show()
        sys.exit(app.exec_())
Example #12
0
def main():
	app = QApplication(sys.argv)
	app.setOrganizationName("ReText project")
	app.setApplicationName("ReText")
	app.setApplicationDisplayName("ReText")
	app.setApplicationVersion(app_version)
	app.setOrganizationDomain('mitya57.me')
	if hasattr(app, 'setDesktopFileName'): # available since Qt 5.7
		app.setDesktopFileName('me.mitya57.ReText.desktop')
	QNetworkProxyFactory.setUseSystemConfiguration(True)
	RtTranslator = QTranslator()
	for path in datadirs:
		if RtTranslator.load('retext_' + globalSettings.uiLanguage,
		                     join(path, 'locale')):
			break
	QtTranslator = QTranslator()
	QtTranslator.load("qt_" + globalSettings.uiLanguage,
		QLibraryInfo.location(QLibraryInfo.TranslationsPath))
	app.installTranslator(RtTranslator)
	app.installTranslator(QtTranslator)
	if globalSettings.appStyleSheet:
		sheetfile = QFile(globalSettings.appStyleSheet)
		sheetfile.open(QIODevice.ReadOnly)
		app.setStyleSheet(QTextStream(sheetfile).readAll())
		sheetfile.close()
	window = ReTextWindow()
	window.show()
	# ReText can change directory when loading files, so we
	# need to have a list of canonical names before loading
	fileNames = list(map(canonicalize, sys.argv[1:]))
	previewMode = False
	for fileName in fileNames:
		if QFile.exists(fileName):
			window.openFileWrapper(fileName)
			if previewMode:
				window.actionPreview.trigger()
		elif fileName == '--preview':
			previewMode = True
	if sys.stdin:
		inputData = '' if sys.stdin.isatty() else sys.stdin.read()
		if inputData or not window.tabWidget.count():
			window.createNew(inputData)
	signal.signal(signal.SIGINT, lambda sig, frame: window.close())
	sys.exit(app.exec())
Example #13
0
def main(args=sys.argv):
    make_logger("unicodemoticon", emoji=True)
    lock = set_single_instance("unicodemoticon")
    check_encoding()
    set_process_name("unicodemoticon")
    set_process_priority()
    app = QApplication(args)
    app.setApplicationName("unicodemoticon")
    app.setOrganizationName("unicodemoticon")
    app.setOrganizationDomain("unicodemoticon")
    app.instance().setQuitOnLastWindowClosed(False)  # no quit on dialog quit
    if qdarkstyle:
            app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
    icon = QIcon(app.style().standardPixmap(QStyle.SP_FileIcon))
    app.setWindowIcon(icon)
    mainwindow = MainWidget()
    mainwindow.show()
    mainwindow.hide()
    make_post_exec_msg(start_time)
    sys.exit(app.exec())
def setupApplication():
    app = QApplication(sys.argv)
    #app.aboutToQuit.connect(appExitHandler)
    darkPalette = QPalette()
    darkPalette.setColor(QPalette.Window, QColor(0, 0, 0))
    darkPalette.setColor(QPalette.WindowText, Qt.white)
    darkPalette.setColor(QPalette.Base, QColor(25, 25, 25))
    darkPalette.setColor(QPalette.AlternateBase, QColor(0, 0, 0))
    darkPalette.setColor(QPalette.ToolTipBase, Qt.white)
    darkPalette.setColor(QPalette.ToolTipText, Qt.white)
    darkPalette.setColor(QPalette.Text, Qt.white)
    darkPalette.setColor(QPalette.Button, QColor(0, 0, 0))
    darkPalette.setColor(QPalette.ButtonText, Qt.black)
    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)
    app.setPalette(darkPalette)
    app.setStyleSheet("QScrollBar:vertical {background-color: black}  QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {background: none;}")
    return app
Example #15
0
def main():
    # The app object is the application running on your computer.
    app = QApplication(sys.argv)
    app.setStyleSheet(load_stylesheet('mu.css'))

    # A splash screen is a logo that appears when you start up the application.
    # The image to be "splashed" on your screen is in the resources/images
    # directory.
    splash = QSplashScreen(load_pixmap('icon'))
    splash.show()

    # Make the editor with the Mu class defined above.
    the_editor = Mu()
    the_editor.show()
    the_editor.autosize_window()

    # Remove the splash when the_editor has finished setting itself up.
    splash.finish(the_editor)

    # Stop the program after the application finishes executing.
    sys.exit(app.exec_())
Example #16
0
def main():
    parser = get_parser()
    args = parser.parse_args()
    app = QApplication([])
    app.setWindowIcon(QIcon(QPixmap(":/logo_small")))
    app.setOrganizationName('Hardcoded Software')
    app.setApplicationName('moneyGuru')
    settings = QSettings()
    if args.debug:
        LOGGING_LEVEL = logging.DEBUG
    else:
        LOGGING_LEVEL = logging.DEBUG if adjust_after_deserialization(settings.value('DebugMode')) else logging.WARNING
    setupQtLogging(level=LOGGING_LEVEL, log_to_stdout=args.log_to_stdout)
    logging.debug('started in debug mode')
    if ISLINUX:
        stylesheetFile = QFile(':/stylesheet_lnx')
    else:
        stylesheetFile = QFile(':/stylesheet_win')
    stylesheetFile.open(QFile.ReadOnly)
    textStream = QTextStream(stylesheetFile)
    style = textStream.readAll()
    stylesheetFile.close()
    app.setStyleSheet(style)
    lang = settings.value('Language')
    locale_folder = op.join(BASE_PATH, 'locale')
    hscommon.trans.install_gettext_trans_under_qt(locale_folder, lang)
    # Many strings are translated at import time, so this is why we only import after the translator
    # has been installed
    from qt.app import MoneyGuru
    app.setApplicationVersion(MoneyGuru.VERSION)
    mgapp = MoneyGuru(filepath=args.filepath)
    install_excepthook('https://github.com/hsoft/moneyguru/issues')
    exec_result = app.exec_()
    del mgapp
    # Since PyQt 4.7.2, I had crashes on exit, and from reading the mailing list, it seems to be
    # caused by some weird crap about C++ instance being deleted with python instance still living.
    # The worst part is that Phil seems to say this is expected behavior. So, whatever, this
    # gc.collect() below is required to avoid a crash.
    gc.collect()
    return exec_result
Example #17
0
def main():
	if markups.__version_tuple__ < (2, ):
		sys.exit('Error: ReText needs PyMarkups 2.0 or newer to run.')

	# If we're running on Windows without a console, then discard stdout
	# and save stderr to a file to facilitate debugging in case of crashes.
	if sys.executable.endswith('pythonw.exe'):
		sys.stdout = open(devnull, 'w')
		sys.stderr = open('stderr.log', 'w')

	if hasattr(Qt, 'AA_ShareOpenGLContexts'):
		# Needed for Qt WebEngine on Windows
		QApplication.setAttribute(Qt.AA_ShareOpenGLContexts)
	app = QApplication(sys.argv)
	app.setOrganizationName("ReText project")
	app.setApplicationName("ReText")
	app.setApplicationDisplayName("ReText")
	app.setApplicationVersion(app_version)
	app.setOrganizationDomain('mitya57.me')
	if hasattr(app, 'setDesktopFileName'): # available since Qt 5.7
		app.setDesktopFileName('me.mitya57.ReText.desktop')
	QNetworkProxyFactory.setUseSystemConfiguration(True)
	initializeDataDirs()
	RtTranslator = QTranslator()
	for path in datadirs:
		if RtTranslator.load('retext_' + globalSettings.uiLanguage,
		                     join(path, 'locale')):
			break
	QtTranslator = QTranslator()
	QtTranslator.load("qtbase_" + globalSettings.uiLanguage,
		QLibraryInfo.location(QLibraryInfo.TranslationsPath))
	app.installTranslator(RtTranslator)
	app.installTranslator(QtTranslator)
	print('Using configuration file:', settings.fileName())
	if globalSettings.appStyleSheet:
		sheetfile = QFile(globalSettings.appStyleSheet)
		sheetfile.open(QIODevice.ReadOnly)
		app.setStyleSheet(QTextStream(sheetfile).readAll())
		sheetfile.close()
	window = ReTextWindow()
	window.show()
	# ReText can change directory when loading files, so we
	# need to have a list of canonical names before loading
	fileNames = list(map(canonicalize, sys.argv[1:]))
	previewMode = False
	readStdIn = False
	if globalSettings.openLastFilesOnStartup:
		window.restoreLastOpenedFiles()
	for fileName in fileNames:
		if QFile.exists(fileName):
			window.openFileWrapper(fileName)
			if previewMode:
				window.actionPreview.setChecked(True)
				window.preview(True)
		elif fileName == '--preview':
			previewMode = True
		elif fileName == '-':
			readStdIn = True

	inputData = ''
	if readStdIn and sys.stdin is not None:
		if sys.stdin.isatty():
			print('Reading stdin, press ^D to end...')
		inputData = sys.stdin.read()
	if inputData or not window.tabWidget.count():
		window.createNew(inputData)
	signal.signal(signal.SIGINT, lambda sig, frame: window.close())
	sys.exit(app.exec())
Example #18
0
__Copyright__ = 'Copyright (c) 2019 Irony'
__Version__ = 1.0


class TestWindow(QWidget):
    def __init__(self, *args, **kwargs):
        super(TestWindow, self).__init__(*args, **kwargs)
        layout = QHBoxLayout(self)
        btn1 = QPushButton('鼠标悬停1', self, minimumHeight=38, toolTip='这是按钮1')
        ToolTip.bind(btn1)
        layout.addWidget(btn1)

        btn2 = QPushButton('鼠标悬停2', toolTip='这是按钮2')
        ToolTip.bind(btn2)
        layout.addWidget(btn2)


if __name__ == '__main__':
    import sys
    from PyQt5.QtWidgets import QApplication, QHBoxLayout, QPushButton
    app = QApplication(sys.argv)
    app.setStyleSheet("""ToolTip > QLabel {
    color: white;
    border-radius: 5px;
    padding: 10px;
    background-color: rgba(77, 77, 77, 180);
    }""")
    w = TestWindow()
    w.show()
    sys.exit(app.exec_())
Example #19
0
    def enableRecordingMode(self):
        print('Engaging recording mode...')
        if self.state is AwsPlotterState.RECORDING:
            self.awssr.clearRecord()
            self.openRecordCreationDialog()
        elif self.state is AwsPlotterState.PLAYING:
            self.awsdr.clearSimulation()
            self.awsdr.closeWidget()

            self.instantiateAwssr()
            self.inflateMainWidget(self.awssr)
            self.openRecordCreationDialog()
        
    def enableFileImportMode(self):
        print('Engaging file import mode...')
        if self.state is AwsPlotterState.PLAYING:
            self.awsdr.clearSimulation()
            self.launchAwsdrFileImport()
        elif self.state is AwsPlotterState.RECORDING:
            self.awssr.clearRecord()
            self.awssr.closeWidget()

            self.instantiateAwsdr()
            self.inflateMainWidget(self.awsdr)
            self.launchAwsdrFileImport()

if __name__ == '__main__':
    app = QApplication(sys.argv)
    app.setStyleSheet(qss)
    awsp = AwesomePlotter()
    sys.exit(app.exec_())
Example #20
0
    def form_view(self):
        mainLayout = QVBoxLayout(self.form_widget)
        mainLayout.setAlignment(Qt.AlignCenter)

        widget = QWidget()
        widget.setMaximumWidth(350)
        formLayout = NoteForm(widget)
        mainLayout.addWidget(widget)

    def goBack(self):
        editor.disgard()
        self.stack.setCurrentIndex(0)


if __name__ == '__main__':
    app = QApplication([])
    # default font
    font = QFont()
    font.setPointSize(12)

    noteModel = InitDb()

    app.setStyleSheet(open('./custom.qss').read())

    editor = NoteContent()
    highlight = syntax.MardownHighlighter(editor.document())

    window = MainWindow()
    window.show()
    app.exec_()
Example #21
0
        if self.kita_thread is None:
            self.kita_thread = KitaThread(page, max)
            self.kita_thread.status_changed.connect(self.on_thread_status_changed)
            self.kita_thread.finished.connect(self.on_thread_finished)
            self.kita_thread.start()

    def on_thread_status_changed(self, percent, message):
        self.ui.progressBar.setValue(percent)
        self.ui.label.setText(message)

    def on_thread_finished(self):
        self.ui.tableWidget.setColumnCount(len(self.kita_thread.header_cols))
        self.ui.tableWidget.setHorizontalHeaderLabels(self.kita_thread.header_cols)

        self.ui.tableWidget.setRowCount(len(self.kita_thread.rows))
        for row_idx, row in enumerate(self.kita_thread.rows):
            for col_idx, col in enumerate(row):
                item = QTableWidgetItem(col)
                self.ui.tableWidget.setItem(row_idx, col_idx, item)

        self.kita_thread = None
        self.ui.pushButton.setText('시작')


if __name__ == '__main__':
    app = QApplication(sys.argv)
    app.setStyleSheet('QTableView { selection-color: red; selection-background-color: yellow; }')
    window = Window()
    sys.exit(app.exec_())

Example #22
0
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
""")

    #create Quark application
    app = QApplication(sys.argv)
    win = MainWindow()

    themeFile = open(quarkSettings.theme_file, "r")
    app.setStyleSheet(themeFile.read())
    themeFile.close()

    #execute the app
    win.show()
    app.exec_()
Example #23
0
    palette.setColor(QPalette.Disabled, QPalette.Base, QColor("#333333"))
    palette.setColor(QPalette.AlternateBase, QColor(53,53,53))
    palette.setColor(QPalette.Highlight, QColor(255,160,47))
    palette.setColor(QPalette.WindowText, QColor("#EBEBEB"))
    palette.setColor(QPalette.Disabled, QPalette.WindowText, QColor("#a1a1a1"))
    palette.setColor(QPalette.Text, QColor("#EBEBEB"))
    palette.setColor(QPalette.Disabled, QPalette.Text, QColor("#a100a1"))
    palette.setColor(QPalette.Button, QColor(53,53,53))
    palette.setColor(QPalette.Disabled, QPalette.Button, QColor("#1b1e21"))
    palette.setColor(QPalette.ButtonText, QColor(255,255,255))
    palette.setColor(QPalette.Disabled, QPalette.ButtonText, QColor("#a1a1a1"))
    palette.setColor(QPalette.Link, QColor(42, 130, 218))
    palette.setColor(QPalette.ToolTipText, QColor("#EBEBEB"))
    app.setPalette(palette)
    app.setStyleSheet("QMenu::item:selected { padding: 2px 25px 2px 20px; color: #ffffff; background-color: #FFA02F; }"
                      "\nQMenu::item{ padding: 2px 25px 2px 20px; border: 1px solid transparent; }"
                      #"\nQMdiSubWindow { border: 1px solid #000000; border-radius:1px; background: #404040 ; }"
                      )
    # Launch application
    sys._excepthook = sys.excepthook

    #Launch app and intercept exceptions occuring in qt slots
    def exception_hook(exctype, value, traceback):
        sys._excepthook(exctype, value, traceback)
        time.sleep(10)
        sys.exit(1)
    sys.excepthook = exception_hook
    win = RetinaApp()
    #sys.exit(app.exec_())
    try:
        app.exec_()
    except:
                                   hovericon=icon_dict[i][1],
                                   parent=self,
                                   onClicked=self.handleButtonClick)
            button.setToolTip(i)
            buttonGrid.addWidget(button, n // 15, n % 15)

        mainLayout = QVBoxLayout(self)
        mainLayout.addWidget(scrollarea)
        self.setWindowIcon(icon_dict["calculator"][0])

    def handleButtonClick(self):
        pass


if __name__ == '__main__':

    import sys

    app = QApplication(sys.argv)

    # set stylesheet
    file = QFile(":/dark.qss")
    file.open(QFile.ReadOnly | QFile.Text)
    stream = QTextStream(file)
    app.setStyleSheet(stream.readAll())

    calc = CalculatorApp()
    calc.show()
    sys.exit(app.exec_())

    del calc
Example #25
0
            self.resize(QMouseEvent.pos().x(), QMouseEvent.pos().y())
            QMouseEvent.accept()
        elif Qt.LeftButton and self._move_drag:
            # 标题栏拖放窗口位置
            self.move(QMouseEvent.globalPos() - self.move_DragPosition)
            QMouseEvent.accept()

    def mouseReleaseEvent(self, QMouseEvent):
        # 鼠标释放后,各扳机复位
        self._move_drag = False
        self._corner_drag = False
        self._bottom_drag = False
        self._right_drag = False
        self._left_drag = False
        self._top_drag = False
        self._top_left_corner_drag = False
        self._top_right_corner_drag = False
        self._bottom_left_corner_drag = False


if __name__ == "__main__":
    from PyQt5.QtWidgets import QApplication
    import sys
    app = QApplication(sys.argv)
    app.setStyleSheet(open("./UnFrameStyle.qss").read())
    window = QUnFrameWindow()
    window.setCloseButton(True)
    window.setMinMaxButtons(True)
    window.show()
    sys.exit(app.exec_())
Example #26
0
    app = QApplication(sys.argv)

    app.setStyleSheet('''
        QPushButton{
            min-height: 20px;
        }
        QPushButton:pressed {
        background-color: rgb(224, 0, 0);
        border-style: inset;
        }
        QPushButton#cancel{
           background-color: red ;
        }
        myPushButton{
            background-color: #E0E0E0 ;
            height:20px;
            border-style: outset;
            border-width: 2px;
            border-radius: 10px;
            border-color: beige;
            font: Italic 13px;
            min-width: 10em;
            padding: 6px;
        }
        myPushButton:hover {
        background-color: #d0d0d0;
        border-style: inset;
        }
        ''')

    window = CheckWindow()
Example #27
0
        window1.contain(MainWindow1)
        window1.start_button.clicked.connect(lambda: MainWindow1.close())
        MainWindow1.show()
        sys.exit(app1.exec_())

finally:
    linecache.clearcache()

    app2 = QApplication(sys.argv)
    """ Set font and theme in main window """
    font_line = linecache.getline("settings.txt", 7)
    theme_line = linecache.getline("settings.txt", 8)
    if not theme_line[theme_line.find("=") + 2:-1] == "Default":
        style_css = "Theme/%s.qss" % theme_line[theme_line.find("=") + 2:-1]
        style = open(style_css, "r")
        app2.setStyleSheet(style.read() + "* {font-family: %s;}" %
                           font_line[font_line.find("=") + 2:-1])
    else:
        app2.setStyleSheet("* {font-family: %s;}" %
                           font_line[font_line.find("=") + 2:-1])
    """ Set language in main window """
    if linecache.getline("settings.txt", 4) == "Language = English\n":
        new_language_file = open("Language/languageEnglish.txt").read()
    elif linecache.getline("settings.txt", 4) == "Language = Polski\n":
        new_language_file = open("Language/languagePolish.txt").read()

    new_file = open("Language/Language.txt", 'w')
    new_file.write(new_language_file)
    new_file.close()

    MainWindow2 = QMainWindow()
    window2 = window.main()
Example #28
0
        self.categoryBtn = QToolButton(self)
        self.categoryBtn.setText("分类")
        self.categoryBtn.setObjectName("categoryBtn")
        categoryMap = QPixmap("./themes/default/images/category.png")
        categoryMap.width = 50
        categoryMap.height = 50
        categoryIcon = QIcon(categoryMap)
        self.categoryBtn.setIconSize(QSize(50, 50))
        self.categoryBtn.setIcon(categoryIcon)
        self.categoryBtn.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
        #按钮菜单,横向布局
        hlayout = QHBoxLayout(self, spacing=4)
        hlayout.setContentsMargins(10, 0, 0, 0)
        hlayout.addWidget(self.indexBtn)
        hlayout.addWidget(self.categoryBtn)
        hlayout.addStretch(1)


if __name__ == "__main__":
    import sys
    import os
    os.chdir("../../")
    from PyQt5.QtWidgets import QApplication
    from PyQt5.QtGui import QFontDatabase
    app = QApplication(sys.argv)
    QFontDatabase.addApplicationFont("themes/default/fonts/default.ttf")
    app.setStyleSheet(
        open("themes/default/qss/default.qss", "rb").read().decode("utf-8"))
    w = MenuWidget()
    w.show()
    sys.exit(app.exec_())
Example #29
0


import signal

signal.signal(signal.SIGINT, signal.SIG_DFL)

if __name__ == '__main__':
    cfg = config.load(sys.argv[1])
    try:
        img_path=sys.argv[2]
    except IndexError:
        img_path=None

    #starting comm
    jdrc= comm.init(cfg, 'ColorTuner')

    cameraCli = jdrc.getCameraClient("ColorTuner.Camera")
    camera = CameraFilter(cameraCli)
    
    app = QApplication(sys.argv)
    frame = MainWindow(img_path)
    frame.setCamera(camera)
    frame.show()
    app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())

    t2 = ThreadGUI(frame)  
    t2.daemon=True
    t2.start()
    
    sys.exit(app.exec_()) 
    app.setStyleSheet("""QTreeView {
    outline: 0px;
    background: rgb(47, 64, 78);
}
QTreeView::item {
    min-height: 92px;
}
QTreeView::item:hover {
    background: rgb(41, 56, 71);
}
QTreeView::item:selected {
    background: rgb(41, 56, 71);
}

QTreeView::item:selected:active{
    background: rgb(41, 56, 71);
}
QTreeView::item:selected:!active{
    background: rgb(41, 56, 71);
}

QTreeView::branch:open:has-children {
    background: rgb(41, 56, 71);
}

QTreeView::branch:has-siblings:!adjoins-item {
    background: green;
}
QTreeView::branch:closed:has-children:has-siblings {
    background: rgb(47, 64, 78);
}

QTreeView::branch:has-children:!has-siblings:closed {
    background: rgb(47, 64, 78);
}

QTreeView::branch:open:has-children:has-siblings {
    background: rgb(41, 56, 71);
}

QTreeView::branch:open:has-children:!has-siblings {
    background: rgb(41, 56, 71);
}
QTreeView:branch:hover {
    background: rgb(41, 56, 71);
}
QTreeView:branch:selected {
    background: rgb(41, 56, 71);
}
    """)
Example #31
0
        index_ = self.tableView.currentIndex().row()
        if (index_ == -1):
            print(
                QMessageBox.warning(self, "警告", "您没有选中任何记录", QMessageBox.Yes,
                                    QMessageBox.Yes))
            return
        else:
            str = self.queryModel.data(self.queryModel.index(index_, 0))
            type = self.queryModel.data(self.queryModel.index(index_, 2))
            if (type == '身份证识别'):
                self.recordDetail_id(str)
            else:
                self.recordDetail(str)

    def recordDetail(self, RecordId):
        recorddetaildialog = RecordDetailDialog(RecordId)
        recorddetaildialog.show()
        recorddetaildialog.exec_()

    def recordDetail_id(self, RecordId):
        recorddetail_id = RecordDetailDialog_id(RecordId)
        recorddetail_id.show()
        recorddetail_id.exec_()


if __name__ == '__main__':
    app = QApplication(sys.argv)
    app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
    recordsWindow = RecordsViewer()
    recordsWindow.show()
    sys.exit(app.exec_())
Example #32
0
                    index += 1
            self.comic_files_path = list(set(self.comic_files_path))
            self.comic_files_path.sort()
            print(self.comic_files_path)

    def get_help(self):
        help_window = HelpWindow(self)
        help_window.show()

    def execute(self):
        # name = self.output_name.text()
        if os.name == 'nt':
            path = QFileDialog.getSaveFileUrl(
                self, "请保存文件", os.path.join(os.path.expanduser('~'),
                                            "Desktop"), "pdf files(*.pdf)")
            # type: (QUrl, str)
        else:
            path = QFileDialog.getSaveFileUrl(
                self, "请保存文件", '/', "pdf files(*.pdf)")  # type: (QUrl, str)
        name = path[0].url()
        logic.thread_it(logic.rea, self.comic_files_path, name, self.log_box)


if __name__ == '__main__':
    import resources
    resources.qInitResources()
    app = QApplication(sys.argv)
    app.setStyleSheet(Const.QSS)
    root = RootWindows()
    root.show()
    sys.exit(app.exec())
Example #33
0
    def run(self):
        oen_re = ttm.get_oen_re()
        smtp = ttm.get_smtp(self.email_user, self.email_pass)
        for page in self.reader.pages:
            msg = ttm.get_message(page,
                                  self.email_user,
                                  self.subject,
                                  oen_re,
                                  self.no_reply,
                                  self.body)
            smtp.send_message(msg)

            self.communicate.mailed.emit(msg['To'])
            self.sleep(2)
        smtp.close()


if __name__ == '__main__':
    qt_app = QApplication(sys.argv)
    qt_app.setStyleSheet('QWidget { font-size:18px;}')
    app = MainWindow()

    msg_box = QMessageBox()
    msg_box.setText(" ".join(["Remember to use the students' 'given names'",
                              "when generating lists in Maplewood"]))
    msg_box.exec_()

    app.show()
    qt_app.exec_()
Example #34
0
        SettingsDialog.resize(400, 400)
        SettingsDialog.Tabs.setMinimumWidth(800)
        SettingsDialog.show()
    #---------------------------------------------------------------------------
    def show_user_manual_slot(self):
        help = THelpForm(self, 'User\'s Manual', 'main.html')
    #---------------------------------------------------------------------------
    def show_setting_dialog_help_slot(self):
        help = THelpForm(self, 'Settings Dialog', 'settings.html')
    #---------------------------------------------------------------------------
    def show_hotkeys_help_slot(self):
        help = THelpForm(self, 'Hotkeys', 'hotkeys.html')
#-------------------------------------------------------------------------------
if __name__ == '__main__':

    print('Qt Version: ' + QT_VERSION_STR)
    
    app  = QApplication(sys.argv)
    
    with open( os.path.join(resources_path, 'scmgr.qss'), 'rb') as fqss:
        qss = fqss.read().decode()
        qss = re.sub(os.linesep, '', qss )
    app.setStyleSheet(qss)
    
    mwin = MainWindow()

    sys.exit( app.exec_() )
#-------------------------------------------------------------------------------


Example #35
0
        os.mkdir(SONGS_PATH)


if __name__ == "__main__":
    ensure_data_dir()

    app = QApplication(sys.argv)
    app.setQuitOnLastWindowClosed(True)
    app.setWindowIcon(QIcon(WINDOW_ICON))
    app.setApplicationName("FeelUOwn")
    app_event_loop = QEventLoop(app)
    asyncio.set_event_loop(app_event_loop)

    qss = QSS_PATH
    with open(qss, "r") as qssfile:
        app.setStyleSheet(qssfile.read())

    if MODE != DEBUG:
        f_handler = open(LOGFILE, 'w')
        sys.stdout = f_handler
        sys.stderr = f_handler

    w = Controller()
    w.move((QApplication.desktop().width() - w.width())/2,
           (QApplication.desktop().height() - w.height())/2)
    w.show()

    app_event_loop.run_forever()

    sys.exit()
Example #36
0
@email: [email protected]
@file: critical
@description: 
'''

__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: [email protected]"
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
__Version__ = "Version 1.0"

import sys

from PyQt5.QtWidgets import QApplication, QMessageBox

app = QApplication(sys.argv)
app.setStyleSheet('''QDialogButtonBox {
    dialogbuttonbox-buttons-have-icons: 1;
    dialog-ok-icon: url(../icons/Ok.png);
    dialog-open-icon: url(../icons/Open.png);
    dialog-save-icon: url(../icons/Save.png);
    dialog-cancel-icon: url(../icons/Cancel.png);
}

QMessageBox {
    messagebox-critical-icon: url(../icons/Close.png);
}
''')
QMessageBox.critical(
    None, "提示critical", "消息",
    QMessageBox.Ok | QMessageBox.Open | QMessageBox.Save | QMessageBox.Cancel)
sys.exit()
Example #37
0
    def closeEvent(self, QCloseEvent):
        print('closeEvent')
        # result = QMessageBox(QIcon('is.png'), 'yes', 'no')

    def contextMenuEvent(self, qContextMenuEvent):

        cmenu = QMenu()
        newAct = cmenu.addAction('New')
        newAct.triggered.connect(self.close)

        selectedAct = cmenu.exec_(self.mapToGlobal(qContextMenuEvent.pos()))


if __name__ == '__main__':
    app = QApplication(sys.argv)
    app.setStyleSheet(open('res/QtDarkOrange.qss').read())

    splashPix = QtGui.QPixmap('res/logo2.png')

    from controls.SplashScreen import *

    splash = SplashScreen(splashPix)
    splash.setTitle('GraphNode')
    splash.show()
    splash.setMessage("v0.1")
    app.processEvents()

    import time
    time.sleep(0.3)

    # splash.setMessage("Load Editor...")
Example #38
0
    def leaveEvent(self, event):
        """鼠标离开时隐藏删除按钮"""
        super(ProjectItemWidget, self).leaveEvent(event)
        self.buttonDelete.setVisible(False)

    def paintEvent(self, event):
        super(ProjectItemWidget, self).paintEvent(event)
        pixmap = self.pixmap()
        if not pixmap or pixmap.isNull():
            # 画虚线边框
            painter = QPainter(self)
            pen = painter.pen()
            pen.setStyle(Qt.DashLine)
            pen.setWidth(2)
            painter.setPen(pen)
            painter.drawRoundedRect(self.rect().adjusted(20, 20, -20, -20), 4,
                                    4)


if __name__ == '__main__':
    import sys
    from PyQt5.QtWidgets import QApplication
    from PyQt5.QtGui import QFontDatabase
    from Utils.Tools import readData
    app = QApplication(sys.argv)
    app.setStyleSheet(readData('../../Resources/Themes/Default.qss'))
    QFontDatabase.addApplicationFont('../../Resources/Fonts/qtskin.ttf')
    w = ProjectItemWidget({'name': 'name', 'time': '2018/8/9'})
    w.show()
    sys.exit(app.exec_())
Example #39
0
    # "border-style: solid;"
    # "color: rgb(255,255,255);"
    # "border-width: 2px;"
    # "border-color: rgb( %d, %d, %d);" % (colour.red(), colour.green(), colour.blue()))
    # self.btn.setStyleSheet("font: bold italic 12pt 'Times New Roman';"
    # "background-color: rgb(0,0,0);"
    # "border-style: solid;"
    # "color: rgb(255,255,255);"
    # "border-width: 2px;"
    # "border-color: rgb( %d, %d, %d);" % (colour.red(), colour.green(), colour.blue()))

    # for i in range(len(light)):
    # self.sendInfo(red, blue, green, light[i])

    # self.show()

    def sensorRead(self):
        return 200

    def pingPong(
        self
    ):  # array organized as len(arr[]) == number of arduinos, arr[][i] returns number of lights connected to arduino. Current usable max return [[1,1,1,1,1,1,1,1],[8,8,8,8,8,8,8,8]]
        return [[1, 1, 1, 1, 1, 1, 1, 1], [8, 8, 8, 8, 8, 8, 8, 8]]


app = QApplication(sys.argv)
app.setStyleSheet(
    "QMainWindow{background-color: darkgray;border: 1px solid black}")

ex = Control()
sys.exit(app.exec_())
Example #40
0
'''
# gui.py - Handles starting the Graphical User Interface for the Simulation

'''

import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QPalette
from PyQt5.QtCore import Qt
from GameOfLife import GameOfLife
from DataParser import DataParser

APP = QApplication(sys.argv)
APP.setStyleSheet(open('styles.css').read())

PARSER = DataParser()
PARSER.LoadDataFile("inputData.xml")

WINDOW = GameOfLife()
sys.exit(APP.exec_())
Example #41
0
class Newwindow(QWebEngineView):
    def __init__(self, text):
        super().__init__()
        self.setWindowTitle(text)
        self.icon = QIcon()
        self.icon.addPixmap(QPixmap(":/img/img/logo.ico"))
        self.setWindowIcon(self.icon)
        self.resize(900, 600)

    def UiInit(self, str='https://www.zhihu.com/billboard/'):
        self.load(QUrl(str))


class Form(QWidget, Ui_Form):
    def __init__(self, num, title, val):
        super().__init__()
        self.setupUi(self)
        self.num.setText(num)
        self.title.setText(title)
        self.value.setText(str(val))


if __name__ == '__main__':
    app = QApplication(argv)
    w = MainWindow()
    app.setStyleSheet(load_stylesheet_pyqt5())
    w.show()
    # print(w.size().height())
    exit(app.exec_())
Example #42
0
class QtGuiController(QObject):
    """
    Starts the Qt GUI and glues the program's events to the interface.
    """
    show_start = pyqtSignal()
    show_choose = pyqtSignal(str)
    show_account = pyqtSignal(str, int)
    show_remove = pyqtSignal()

    def __init__(self, controller: CoffeeFundController):
        super().__init__()
        self.app = QApplication(sys.argv)
        self.app.setOverrideCursor(Qt.BlankCursor)
        self.set_styles()
        self.main_window = CoffeeFundWindow()
        self.controller = controller

        # signals and slots setup
        self.show_start.connect(self.main_window.show_start)
        self.show_choose.connect(self.main_window.show_choose_action)
        self.show_account.connect(self.main_window.show_account)
        self.show_remove.connect(self.main_window.show_remove)

        self.main_window.signal_back.connect(self.relay_gui_back)
        self.main_window.signal_coffee.connect(self.relay_gui_coffee)
        self.main_window.signal_account.connect(self.relay_gui_account)

    def run(self):
        # hide the cursor - this is a touch app
        self.main_window.showFullScreen()
        self.show_start.emit()
        sys.exit(self.app.exec_())

    def set_styles(self):
        with open("styles/gui_style.qss") as style_file:
            style = style_file.read()
            self.app.setStyleSheet(style)
            logger.debug("set stylesheet")

    def relay_gui_account(self):
        event = InputEvent(InputAction.account_info)
        self.gui_to_controller_event(event)

    def relay_gui_back(self):
        event = InputEvent(InputAction.back)
        self.gui_to_controller_event(event)

    def relay_gui_coffee(self):
        event = InputEvent(InputAction.coffee)
        self.gui_to_controller_event(event)

    def gui_to_controller_event(self, event):
        self.controller.enqueue_event(event)

    def apply_state_change(self, event: StateChangedEvent):
        if event.state == StateType.wait_for_card:
            print("Showing card Start for wait for card state")
            self.show_start.emit()
        elif event.state == StateType.choose_info_or_coffee:
            print("Showing card ChooseAction for choose_info_or_coffee for user {0}".format(event.context.current_user.name))
            self.show_choose.emit(event.context.current_user.name)
        elif event.state == StateType.remove_card:
            print("Showing card RemoveCard")
            self.show_remove.emit()
        elif event.state == StateType.show_account:
            print("Showing card ShowAccount")
            self.show_account.emit(event.context.current_user.name,
                                   event.context.current_user.balance_as_eur_cents)
        else:
            logger.debug("Unknown state internal {0}".format(event))
Example #43
0
@description: 
'''

__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: [email protected]"
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
__Version__ = "Version 1.0"

import sys

from PyQt5.QtWidgets import QApplication, QMessageBox
app = QApplication(sys.argv)
app.setStyleSheet('''QDialogButtonBox {
    dialogbuttonbox-buttons-have-icons: 1;
    dialog-no-icon: url(../icons/No.png);
    dialog-abort-icon: url(../icons/Abort.png);
    dialog-retry-icon: url(../icons/Retry.png);
    dialog-ignore-icon: url(../icons/Ignore.png);
}

QMessageBox {
    messagebox-warning-icon: url(../icons/Ok.png);
}
''')
QMessageBox.warning(None, "提示warning", "消息",
                    QMessageBox.No |
                    QMessageBox.NoToAll |
                    QMessageBox.Abort |
                    QMessageBox.Retry |
                    QMessageBox.Ignore)
sys.exit()
Example #44
0
def main():
    # Command-line arguments
    parser = argparse.ArgumentParser(
        prog='qbar',
        description="An easily-configurable and good-looking status bar for Linux")
    parser.add_argument(
        "--monitor",
        "-m",
        type=str,
        default=None,
        help="Name of the monitor to display the bar on")

    # TODO: use css for this instead?
    parser.add_argument(
        "--height",
        type=int,
        default=30,
        help="Height (in px) of the status bar")
    parser.add_argument(
        "--css",
        type=str,
        default=None,
        help="Stylesheet file to override the default style")
    parser.add_argument(
        "--config",
        "-c",
        default=None,
        help="Congifuration file for qbar written in yaml.  Looks under $XDG_HOME or .config for qbar/config.yml by default.  if not found, uses a builtin default")
    parser.add_argument(
        "--position",
        "-p",
        type=str,
        default="top",
        choices=["top", "bottom"],
        help="Display position of the bar.  Can be 'top' or 'bottom'")
    parser.add_argument(
        "--log-level",
        "-l",
        default='WARNING',
        choices=['DEBUG', 'INFO', 'WARNING', 'ERROR'],
        help="Change the level of information to be logged.")
    ARGS = parser.parse_args()

    # Log level for the root logger
    numeric_log_level = getattr(logging, ARGS.log_level.upper(), None)
    logging.getLogger().setLevel(numeric_log_level)

    # Init app
    app = QApplication(sys.argv)
    bar = Bar(ARGS.monitor, height=ARGS.height, position=ARGS.position)

    # Set default stylesheet and override with custom one if present
    stylesheet_files = [os.path.abspath(os.path.dirname(__file__)) + "/../configs/default.css"]
    if ARGS.css != None:
        stylesheet_files.append(ARGS.css)
    css_loader = StyleSheetLoader(stylesheet_files, lambda styles: app.setStyleSheet(styles))

    # Find config file path
    cfgfile = ARGS.config if ARGS.config != None else default_user_config_dir() + '/config.py'
    if not os.path.exists(cfgfile):
        if ARGS.config != None:
            logging.error("Specified config file does not exist: %s" % ARGS.config)
        logging.info("Using builtin default config file")
        cfgfile = os.path.abspath(os.path.dirname(__file__)) + "/../configs/default.py"

    # Load config file and set it up to reload whenever the file changes
    cfgmodule = load_config_module(cfgfile)
    bar.items = cfgmodule.items
    def reload_config(filepath):
        logging.info("Config file changed, reloading: %s" % filepath)
        try:
            importlib.reload(cfgmodule)
            bar.items = cfgmodule.items
        except SyntaxError as e:
            logging.error("SyntaxError encountered when attempting to load config file: %s" % str(e))
            bar.items = []
    watcher = QFileSystemWatcher()
    watcher.addPath(cfgfile)
    watcher.fileChanged.connect(reload_config)

    # Run!
    bar.start()
    bar.show()

    # Exit app on ctrl+c.
    # Note that a timer must be present in order for Ctrl+C to work. Otherwise
    # the python interpreter never gets a chance to run and handle the signal.
    sigtimer = QTimer()
    sigtimer.timeout.connect(lambda: None)
    sigtimer.start(500)
    def sigint_handler(signal, frame):
        print("\nReceived Ctrl+C, exiting...")
        bar.stop()
        QApplication.quit()
    signal.signal(signal.SIGINT, sigint_handler)

    ret = app.exec_()
    sys.exit(ret)
Example #45
0
            self.x, self.y = self.x, self.y+0.0005

        elif e.key() == Qt.Key_Left:
            self.x, self.y = self.x, self.y-0.0005

        elif e.key() == Qt.Key_Up:
            self.x, self.y = self.x+0.0005, self.y

        elif e.key() == Qt.Key_Down:
            self.x, self.y = self.x-0.0005, self.y

        m = folium.Map(zoom_start=18,location=(self.x, self.y))
        m.save(self.data, close_file=False)
        m.save("map.html")
        self.webView.reload()

if __name__ == '__main__':
    app = QApplication(sys.argv)
    app.setStyleSheet('''
        QWidget {
            font-size: 35px;
        }
    ''')
    
    myApp = MyApp()
    myApp.show()

    try:
        sys.exit(app.exec_())
    except SystemExit:
        print('Closing Window...')
Example #46
0
        vbox = QVBoxLayout()
        vbox.addWidget(self.button)
        vbox.addWidget(self.tabs)
        self.setLayout(vbox)

        self.resize(600, 600)

    def closeTab(self, index):
        tab = self.tabs.widget(index)
        tab.deleteLater()
        self.tabs.removeTab(index)

    def buttonClicked(self):
        print('-------')
        self.tabs.addTab(Container("smalltext2"), "smalltext2")


app = QApplication([])

app.setStyleSheet("""
    QTabBar::tab:selected {
        background: gray;
        color: white;
    }
""")

widget = CustomWidget()
widget.show()

sys.exit(app.exec_())
Example #47
0
    def __init__(self, *args, **kwargs):
        super(Window, self).__init__(*args, **kwargs)
        self.resize(800, 600)
        layout = QVBoxLayout(self)
        layout.addWidget(  
            ProgressBar(self, minimum=0, maximum=100, objectName="RedProgressBar"))

        layout.addWidget(  
            ProgressBar(self, minimum=0, maximum=0, objectName="RedProgressBar"))

        layout.addWidget(  
            ProgressBar(self, minimum=0, maximum=100, textVisible=False,
                        objectName="GreenProgressBar"))
        layout.addWidget(  
            ProgressBar(self, minimum=0, maximum=0, textVisible=False,
                        objectName="GreenProgressBar"))

        layout.addWidget(  
            ProgressBar(self, minimum=0, maximum=100, textVisible=False,
                        objectName="BlueProgressBar"))
        layout.addWidget(  
            ProgressBar(self, minimum=0, maximum=0, textVisible=False,
                        objectName="BlueProgressBar"))


if __name__ == "__main__":
    app = QApplication(sys.argv)
    app.setStyleSheet(StyleSheet)
    w = Window()
    w.show()
    sys.exit(app.exec_())
Example #48
0
        tab_name = self.tabbar.tabData(activeIndex)["object"]
        tab_content = self.findChild(QWidget, tab_name).content

        tab_content.back()

    def GoForward(self):
        activeIndex = self.tabbar.currentIndex()
        tab_name = self.tabbar.tabData(activeIndex)["object"]
        tab_content = self.findChild(QWidget, tab_name).content

        tab_content.forward()


    def ReloadPage(self):
        activeIndex = self.tabbar.currentIndex()
        tab_name = self.tabbar.tabData(activeIndex)["object"]
        tab_content = self.findChild(QWidget, tab_name).content

        tab_content.reload()



if __name__ == "__main__":
    app = QApplication(sys.argv)
    window = App()

    with open("style.css", "r") as style:
        app.setStyleSheet(style.read())

    sys.exit(app.exec_())
Example #49
0
 def run(cls):
     app = QApplication(sys.argv)
     app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
     window = cls()
     sys.exit(app.exec_())
Example #50
0
                     [150, 232, 201, 154, 190, 330, 410],
                     [320, 332, 301, 334, 390, 330, 320],
                     [820, 932, 901, 934, 1290, 1330, 1320]]
        for i, data_list in enumerate(dataTable):
            series = QLineSeries(self._chart)
            for j, v in enumerate(data_list):
                series.append(j, v)
            series.setName("Series " + str(i))
            series.setPointsVisible(True)  # 显示原点
            series.hovered.connect(self.onSeriesHoverd)
            self._chart.addSeries(series)
        self._chart.createDefaultAxes()  # 创建默认的轴
        self._chart.axisX().setTickCount(7)  # x轴设置7个刻度
        self._chart.axisY().setTickCount(7)  # y轴设置7个刻度
        self._chart.axisY().setRange(0, 1500)  # 设置y轴范围
        self.setChart(self._chart)


if __name__ == "__main__":
    app = QApplication(sys.argv)
    app.setStyleSheet("""QToolTip {
    border: none;
    padding: 5px;
    color: white;
    background: rgb(50,50,50);
    opacity: 100;
}""")
    view = ChartView()
    view.show()
    sys.exit(app.exec_())
Example #51
0
import sys
import theme

from PyQt5.QtWidgets import QApplication
from PyQt5.uic import loadUi

if __name__ == "__main__":

    app = QApplication(sys.argv)
    
    if len(app.arguments()) != 2:
    
        sys.stderr.write("Usage: %s <ui file>\n" % app.arguments()[0])
        sys.exit()

    app.setStyleSheet(theme.load_stylesheet_pyqt5())
    
    window = loadUi(app.arguments()[1])
    window.show()
    sys.exit(app.exec_())
Example #52
0
# coding: utf-8

import sys

from PyQt5.QtWidgets import QApplication

from mainwindow import MainWindow

if __name__ == '__main__':
    app = QApplication(sys.argv)
    with open('Aqua.qss', 'r') as f:
        app.setStyleSheet(f.read())
    w = MainWindow()
    w.show()
    sys.exit(app.exec_())
Example #53
0
    qd.setWidget(aw)
    self.setCentralWidget(qd)
    self.setMinimumSize(480,360)
    self.setMaximumSize(1920,1080)
    self.setDockOptions(QMainWindow.AnimatedDocks | QMainWindow.ForceTabbedDocks);


#############################################################################

if __name__ == '__main__':
    app = QApplication(sys.argv)

    mainwin = AssetWindow()

    mainwin.resize(960,360)
    mainwin.setWindowTitle("Orkid Asset Assistant \N{COPYRIGHT SIGN} 2017 - TweakoZ")
    
    appss = "QWidget {background-color: rgb(64,64,96); color: rgb(255,255,255);}"
    appss += "QTabWidget::pane { border-top: 2px solid #303030;}"
    appss += """QTabBar::tab {
    background: rgb(0,0,0);
    color: rgb(255,255,255);
    }"""
    appss += """QTabBar::tab:selected, QTabBar::tab:hover {
    background: rgb(64,0,0);
    color: rgb(255,255,128);
    }"""

    app.setStyleSheet(appss)
    mainwin.show()
    sys.exit(app.exec_())
Example #54
0
class MemoryTraining(QObject):
    def __init__(self):
        super().__init__()
        self.mainMenu = MainMenu()
        self.mainMenu.show()
        self.mainMenu.setEnabled(False)

        self.winWindow = WinWindow()

        self.game = Game()
        self.game.addMenu(self.mainMenu)

        self.game.addWinWindow(self.winWindow)
        self.winWindow.addGame(self.game)
        self.mainMenu.addGame(self.game)

        self.autorization = Autorization()
        self.autorization.addMenu(self.mainMenu)
        self.autorization.show()
        self.mainMenu.addAuto(self.autorization)


if __name__ == '__main__':
    with open('resources/ui/theme.qss', 'r', encoding='utf-8') as file:
        style_sheet = file.read()
    app = QApplication(sys.argv)
    app.setStyleSheet(style_sheet)
    ex = MemoryTraining()
    sys.exit(app.exec_())
Example #55
0
#NOTE: import like this: version.parent.childs
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QFile
from sys import argv, exit
import os

if __name__ == '__main__':
	from version.gui.gui_constants import default_stylesheet_path as d_style
	from version.gui.gui_constants import user_stylesheet_path as u_style
	
	if len(u_style) is not 0:
		try:
			style_file = QFile(u_style)
		except:
			style_file = QFile(d_style)
	else:
		style_file = QFile(d_style)

	style_file.open(QFile.ReadOnly)
	style = str(style_file.readAll(), 'utf-8')

	app = QApplication(argv)
	from version.constants import WINDOW
	app.setStyleSheet(style)
	exit(app.exec_())
Example #56
0
    def __init__(self, recording=None, exec=True, app=None, **kwargs):
        # Check if exist a default config file in the home (user) directory:
        mp.set_start_method("spawn", force=True)
        inum = kwargs.get("instance_number", -1)
        if inum >= 0:
            default_config_file = Path.home(
            ) / "stytra_setup_config_{}.json".format(inum)
        else:
            default_config_file = Path.home() / "stytra_setup_config.json"
        if default_config_file.is_file():
            config = json.load(open(str(default_config_file)))
        else:
            config = dict()

        # Get rest of configuration parameters from the protocol:
        try:
            extra_config = kwargs["protocol"].stytra_config
            recursive_update(config, extra_config)
        except AttributeError:
            pass

        recursive_update(config, kwargs)  # Use also keyword arguments

        if config.get("scope_triggering", None) == "zmq":
            # Automatically use zmqTrigger if zmq is specified
            from stytra.triggering import ZmqTrigger

            config["scope_triggering"] = ZmqTrigger(port="5555")

        if app is None:
            app = QApplication([])
            app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
            if app.devicePixelRatio() > 1:
                app.setAttribute(Qt.AA_UseHighDpiPixmaps)
        class_kwargs = dict(app=app)
        class_kwargs.update(config)

        base = VisualExperiment

        if "camera" in class_kwargs.keys():
            base = CameraVisualExperiment
            if "tracking" in class_kwargs.keys():
                base = TrackingExperiment
                if not class_kwargs["tracking"].get("embedded", True):
                    class_kwargs["calibrator"] = CircleCalibrator()

            if recording:
                base = VideoRecordingExperiment

        # Stytra logo
        app_icon = QIcon()
        for size in [32, 64, 128, 256]:
            app_icon.addFile(
                pkg_resources.resource_filename(__name__,
                                                "/icons/{}.png".format(size)),
                QSize(size, size),
            )
        app.setWindowIcon(app_icon)

        pg.setConfigOptions(imageAxisOrder="row-major")

        self.exp = base(**class_kwargs)

        self.exp.start_experiment()

        if exec:
            app.exec_()
Example #57
0
"""
import argparse

import qdarkstyle

from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QApplication

from lib import utils
from ui.app import AppWindow

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument("-s", "--script", action='store_true', help="an additional script to load with "
                                                                    "dwarf and frida js api")
    parser.add_argument("-p", "--package", help="package name or pid")
    args = parser.parse_args()

    app = QApplication([])
    app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
    with open('ui/style.qss', 'r') as f:
        app.setStyleSheet(app.styleSheet() + '\n' + f.read())
    app.setWindowIcon(QIcon(utils.resource_path('ui/dwarf.png')))

    app_window = AppWindow(args)
    app_window.showMaximized()

    app.exec_()

    app_window.get_app_instance().get_dwarf().detach()
Example #58
0
def main():
	if platform.system() == "Windows":
		print("Running on Windows")
		# On Windows, redirect stderr to a file
		import imp, ctypes
		if (hasattr(sys, "frozen") or # new py2exe
			hasattr(sys, "importers") or # old py2exe
			imp.is_frozen("__main__")): # tools/freeze
				sys.stderr = open(os.path.expanduser("~/friture.exe.log"), "w")
		# set the App ID for Windows 7 to properly display the icon in the
		# taskbar.
		myappid = 'Friture.Friture.Friture.current' # arbitrary string
		try:
			ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
		except:
			print("Could not set the app model ID. If the plaftorm is older than Windows 7, this is normal.")

	app = QApplication(sys.argv)

	# Splash screen
	pixmap = QPixmap(":/images/splash.png")
	splash = QSplashScreen(pixmap)
	splash.show()
	splash.showMessage("Initializing the audio subsystem")
	app.processEvents()
	
	# Set the separator stylesheet here
	# As of Qt 4.6, separator width is not handled correctly
	# when the stylesheet is applied directly to the QMainWindow instance.
	# QtCreator workarounds it with a "minisplitter" special class
	app.setStyleSheet(STYLESHEET)
	
	# Logger class
	logger = Logger()
	
	window = Friture(logger)
	window.show()
	splash.finish(window)
	
	profile = "no" # "python" or "kcachegrind" or anything else to disable

	if len(sys.argv) > 1:
		if sys.argv[1] == "--python":
			profile = "python"
		#elif sys.argv[1] == "--kcachegrind":
			#profile = "kcachegrind"
		elif sys.argv[1] == "--no":
			profile = "no"
		else:
			print("command-line arguments (%s) not recognized" %sys.argv[1:])

	if profile == "python":
		import cProfile
		import pstats
		
		cProfile.runctx('app.exec_()', globals(), locals(), filename="friture.cprof")
		
		stats = pstats.Stats("friture.cprof")
		stats.strip_dirs().sort_stats('time').print_stats(20)
		stats.strip_dirs().sort_stats('cumulative').print_stats(20)  

		sys.exit(0)
	#elif profile == "kcachegrind":
		#import cProfile
		#import lsprofcalltree

		#p = cProfile.Profile()
		#p.run('app.exec_()')
		
		#k = lsprofcalltree.KCacheGrind(p)
		#data = open('cachegrind.out.00000', 'wb')
		#k.output(data)
		#data.close()

		## alternative code with pyprof2calltree instead of lsprofcalltree
		##import pyprof2calltree
		##pyprof2calltree.convert(p.getstats(), "cachegrind.out.00000") # save
		
		#sys.exit(0)
	else:
		sys.exit(app.exec_())
Example #59
0
        options.iconSize = self.clazz.iconSize()
        return options

if __name__ == "__main__":
    from PyQt5.QtWidgets import QApplication, QPushButton, QWidget, QVBoxLayout, QLabel
    app = QApplication([])
    app.setStyleSheet("""
QPushButton {
    min-width: 100px;
    max-width: 100px;
    min-height: 100px;
    max-height: 100px;
    border-radius: 50px;
    background-color: green;
}
QLabel {
    min-width: 100px;
    max-width: 100px;
    min-height: 100px;
    max-height: 100px;
    border-radius: 50px;
    background-color: red;
    border-radius: 50px;
}
""")
    w = QWidget()

    layout = QVBoxLayout(w)

    btn = QPushButton("--------", w)
    ButtonRotationRnimation(btn)
Example #60
0
import qdarkstyle as qdarkstyle
import sys

from PyQt5.QtWidgets import QApplication

from gui.controller.controller_generation import ControllerGeneration
from gui.controller.main_controller import MainController
from gui.model.level import LevelModel
from gui.model.tilebox import TileBoxModel
from gui.model.toadgan_project import TOADGANProjectModel
from gui.view.main_window import MainWindow

app = QApplication(sys.argv)
# Set the dark style for PyQt5
app.setStyleSheet(qdarkstyle.load_stylesheet(qt_api='pyqt5'))

# Create the models
tilebox_model = TileBoxModel()
level_model = LevelModel()
toadgan_project_model = TOADGANProjectModel()

# Create the GUI
main_window = MainWindow(tilebox_model, level_model, toadgan_project_model)

# Create the controllers
main_controller = MainController(main_window, tilebox_model, level_model)
controller_generation = ControllerGeneration(main_window,
                                             toadgan_project_model)

main_window.show()