Exemplo n.º 1
0
Arquivo: suzu.py Projeto: Xifax/suzu
def main():
    
    app = QApplication(sys.argv)
    app.setWindowIcon(QIcon(PATH_TO_RES + LOGOS + 'suzu.png'))
    
    # application settings #
    options = Options()
    if options.isPlastique():  app.setStyle('plastique')
    
    # main gui module #
    quiz = Quiz(options)
    
    # additional gui components #
    about = About()
    options = OptionsDialog(quiz.srs.db, quiz.options)
    qdict = QuickDictionary(quiz.jmdict, quiz.edict, quiz.kjd, quiz.srs.db, quiz.options)
    
    # background updater #
    updater = BackgroundDownloader(quiz.options.getRepetitionInterval())
    updater.start()
    
    # additional tools #
    tools = Tools()
    web = WebPage()
    statistics = StatsInfo(quiz.srs.db)
    rehash = QuizRehash(quiz.srs.db, quiz.kjd, quiz.edict)
    
    # initializing references and hotkeys #
    quiz.addReferences(about, options, qdict, updater, tools, statistics, web, rehash)
    quiz.initGlobalHotkeys()
    
    try:
        sys.exit(app.exec_())
    except Exception, e:
        log.debug(e)
Exemplo n.º 2
0
def main():
    try:
        app = QApplication(sys.argv)
        #app.setStyle('cleanlooks')
        app.setStyleSheet(qdarkstyle.load_stylesheet())
        db = Database('sample.db')

        icon = QIcon('app.ico')
        app.setWindowIcon(icon)

    #   set the default font for the app
        app.setFont(MEDIUM_FONT)
        app.setStyle(BUTTON_STYLE)

        main_view = MainView()
        main_view.showMaximized()
 
        main_view.show()
        app.exec_()

    #   clean up and exit code
        for model in main_view.models:
            model.submitAll() # commit all pending changes to all models
        db.close()
        app.quit()
        sys.exit(0)
        #os._exit(0)
    except SystemExit:
        print("Closing Window...")
    except Exception as e:
        print(str(e))
Exemplo n.º 3
0
def setStyle():
    if sys.platform == 'win32':
        QApplication.setStyle(u"windows")
    elif sys.platform == 'linux2':
        QApplication.setStyle(u"plastique")
    else:
        print u'Неизвестная система'
Exemplo n.º 4
0
def wraith():
    matplotlib.rcParams['mathtext.fontset'] = 'stixsans'
    app = QCoreApplication.instance()
    app.form = Form()
    #style choices common to both modes
    QApplication.setStyle(QStyleFactory.create('Plastique'))
    QApplication.setPalette(QApplication.style().standardPalette())
    #do it
    app.form.show()
Exemplo n.º 5
0
def main():
    setupLog()
    LOG.debug('%s %s', 'StoryTime', __version__)

    app = QApplication(sys.argv)
    app.setStyle('Plastique')
    wnd = controllers.StoryTimeWindow()
    if len(sys.argv) > 1:
        wnd.loadPaths(sys.argv[1:])
    sys.exit(app.exec_())
Exemplo n.º 6
0
def main():
    matplotlib.rcParams['mathtext.fontset'] = 'stixsans'
    app = QApplication(sys.argv)
    form = Form()
    #style choices common to both modes
    QApplication.setStyle(QStyleFactory.create('Plastique'))
    QApplication.setPalette(QApplication.style().standardPalette())
    #do it
    form.show()
    app.exec_()
Exemplo n.º 7
0
 def __init__(self, parent=None):
     QApplication.setStyle(QStyleFactory.create("Plastique"))
     QApplication.setPalette(QApplication.style().standardPalette())
     super(MainWindow, self).__init__(None)  
     centralwidget = QWidget(self)
     self.setCentralWidget(centralwidget)
     self.layout = QVBoxLayout(centralwidget)
     
     button = QPushButton("Set WSDL Address")
     button.clicked.connect(self.request_wsdl)
     self.layout.addWidget(button)
     
     self.toolbox = QToolBox()
     self.layout.addWidget(self.toolbox)
     self.url = ""
Exemplo n.º 8
0
def main():
    """ Entry point of application

    """
    configure_logs("admin")
    args = configure_commandline_args()
    set_log_level(args.log_level)

    LOGGER.info("Application started")
    app = QApplication(sys.argv)
    # App window style options can be get by printing QStyleFactory.keys()
    QApplication.setStyle(QStyleFactory.create("GTK+"))  # Set style of Heater App to GTK
    app.setStyleSheet(STYLESHEET)
    flow_nvs_file = os.path.join(os.path.dirname(__file__), os.pardir, "libflow",
                                 "admin-libflow-nvs")
    flow_set_nvs_file(flow_nvs_file)
    dummy_controller = AdminController()
    sys.exit(app.exec_())
Exemplo n.º 9
0
def main():
    """ Entry point of application

    """
    configure_logs("display")
    args = configure_commandline_args()
    set_log_level(args.log_level)

    LOGGER.info("Application started")
    app = QApplication(sys.argv)
    # App window style options can be get by printing QStyleFactory.keys()
    QApplication.setStyle(QStyleFactory.create("GTK+"))  # Set style of Heater App to GTK
    app.setStyleSheet(STYLESHEET)
    flow_nvs_file = os.path.join(os.path.dirname(__file__), os.pardir, "libflow",
                                 "display-libflow-nvs")
    flow_set_nvs_file(flow_nvs_file)
    # DisplayController instance get deleted if dummy_controller reference is not used
    dummy_controller = DisplayController()
    sys.exit(app.exec_())
Exemplo n.º 10
0
def log(msg, level, msgbox=False, parent="auto", stack=None):
    """docstring for error"""

    if stack is None:
        stack = inspect.stack()[1][0]

    #print inspect.stack()
    #print stack
    #print inspect.getmodule(stack)


    if inspect.getmodule(stack) is None:
        mod = inspect.stack()[1][1]
    else:
        mod = inspect.getmodule(stack).__name__
    lineno = stack.f_lineno

    if mod == "__main__":
        mod = "__main__:" + os.path.basename(__main__.__file__)

    logging.log(level, msg, extra={"mod": mod, "line": lineno})

    if msgbox:
        if parent == "auto":
            qapp = QApplication.instance()
            if qapp is None:
                qapp = QApplication([])
                qapp.setStyle(QStyleFactory.create("plastique") )
                palette = QPalette(QColor(62, 62, 62), QColor(62, 62, 62))
                palette.setColor(palette.Highlight, QColor(255*0.6, 198*0.6, 0))
                qapp.setPalette(palette)
            parent = qapp.activeWindow()

        if level == logging.DEBUG:
            QMessageBox.info(parent, logging.getLevelName(level).capitalize(), msg)
        elif level == logging.INFO:
            QMessageBox.information(parent, logging.getLevelName(level).capitalize(), msg)
        elif level == logging.WARNING:
            QMessageBox.warning(parent, logging.getLevelName(level).capitalize(), msg)
        elif level == logging.ERROR:
            QMessageBox.critical(parent, logging.getLevelName(level).capitalize(), msg)
        elif level == logging.CRITICAL:
            QMessageBox.critical(parent, logging.getLevelName(level).capitalize(), msg)
Exemplo n.º 11
0
def main():

    argv = sys.argv
    app = QApplication(argv)
    app.setStyle('Cleanlooks')
    main_window = MainWindow()
    main_window.showMaximized()
    main_window.readPreferences()
    if main_window.preferences['open_last'] and not main_window.firstTimeOpened:
        main_window.openFile(str(main_window.preferences['last_path']))

    style_sheet = ''
    style_path = ''

    STYLESHEET = "QListView {show-decoration-selected: 1; }\
               QListView::item:selected {color:#ffffff; background:#006699;} \
               QListView::item:selected:!active {background:#009999;} \
               QListView::item:selected:active {color:#ffffff; background:#006699;} \
               QListView::item:hover {color:#ffffff; background:#003366;}\
               QTableView {show-decoration-selected: 1; }\
               QTableView::item:selected {color:#ffffff; background:#006699;} \
               QTableView::item:selected:!active {background:#009999;} \
               QTableView::item:selected:active {color:#ffffff; background:#006699;} \
               QTableView::item:hover {color:#ffffff; background:#003366;}"

    if main_window.preferences['theme'] == 'Black':
        style_path = 'sci_corpus/ui/black_theme.sty'
    else:
        style_path = 'sci_corpus/ui/white_theme.sty'

    try:
        with open(os.path.abspath(style_path), 'rb') as style_file:
            style_sheet = str(style_file.read())
    except Exception as e:
        print 'Error in style sheet: ', e
        app.setStyleSheet(STYLESHEET)
        pass
    else:
        app.setStyleSheet(style_sheet + STYLESHEET)

    app.exec_()
def main():
    import sys

    try:
        app = QApplication(sys.argv)
        app.setStyle('plastique')

        config = {
            'Event': ('E001', 'E002', 'E003'),
            'Number': ('001', '002'),
            'Sox': ('P1', 'D1', 'F1'),
            'Plans': ('H160', 'H180'),
        }
        selected_config, ok = PreferenceDialog.run(parent=None, config=config)

        print("selected_config:{}, ok:{}".format(selected_config, ok))

    except:
        print(traceback.format_exc())
        logger.error(traceback.format_exc())
        raise IOError("App run Error")
    finally:
        sys.exit(0)
Exemplo n.º 13
0
from PySide.QtNetwork import QNetworkRequest ,\
    QNetworkAccessManager ,\
    QNetworkCookie , \
    QNetworkCookieJar, \
    QNetworkRequest

from PySide import QtCore
from PySide import QtGui 



import dbc_client3


app = QtGui.QApplication(sys.argv)
QApplication.setStyle(QStyleFactory.create('Cleanlooks'))

class Robot(object):
    
    def __init__(self):
        self.view = QWebView() 
        self.page = self.view.page()
        
    def start(self):
        self.view.show()
        QtCore.QObject.connect(self.view, 
                               QtCore.SIGNAL("loadFinished(bool)"), 
                               self.loaded)                            
        self.view.load(QUrl('https://login.yahoo.com/config/login_verify2?&.src=ym'))
    
    def loaded(self):
Exemplo n.º 14
0
                print "Non News late"
                continue
            self.add_stack(new)
            print "add stack"

    def add_stack(self, n):
        self.stack.append(n)


    def get_local_db(self):
        return [2,3,4,5]



if __name__ == '__main__':

    app = QApplication(sys.argv)
    app.setStyle('plastique')

    # OSがタスクトレイに対応しているか確認
    if not QSystemTrayIcon.isSystemTrayAvailable():
        raise OSError("We could't detect any system tray on this system.")

    # ウィンドウが閉じられても、アプリは終了されない:False
    QApplication.setQuitOnLastWindowClosed(False)

    # インスタンス生成
    tasktray = RecomenDesktopApp()
    tasktray.show()
    sys.exit(app.exec_())
Exemplo n.º 15
0
            # data = stream.read(1024)

        except RTMPError, e:
            print e


class Video(QWidget, Ui_VideoWidget):
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.setupUi(self)

        self.controlButton.clicked.connect(self.onControlButton)

    def onControlButton(self):
        self.streamThread = StreamThread()
        self.streamThread.start()

    def keyPressEvent(self, e):
        if e.key() == Qt.Key_Escape:
            self.close()

if __name__ == '__main__':
    # noinspection PyCallByClass
    QApplication.setStyle("plastique")
    app = QApplication(sys.argv)

    video = Video()
    video.show()

    sys.exit(app.exec_())
Exemplo n.º 16
0
            [self.db.get('/fault/{}'.format(k), 0) for k in self.faults])
        self.ui.faults_label.setStyleSheet(alert_style if alert else '')

        alert = any([
            self.db.get('/simulate/{}'.format(k), 0) for k in self.simulations
        ])
        self.ui.simulation_label.setStyleSheet(alert_style if alert else '')

    def _put_checkbox(self, key, checkbox):
        self.sync.put(key, checkbox.isChecked())
        checkbox.blockSignals(True)
        checkbox.setChecked(not checkbox.isChecked())
        checkbox.blockSignals(False)

    def _ui(self, name):
        return getattr(self.ui, name)


if __name__ == '__main__':
    from PySide.QtGui import QApplication, QStyleFactory

    app = QApplication([])
    app.setApplicationName('ARC Reactor')
    app.setStyle(QStyleFactory.create('fusion'))

    window = FrontPanel()
    window.show()

    from .sync import exec_async
    exec_async(app)
Exemplo n.º 17
0
    def figures_context_menu(self, point):
        print point

    def delete_figure(self):
        row = self.figures.currentRow()
        if row != -1:
            self.white_albatross.deleteFigure(row)
            self.figures.setCurrentRow(row)

    def keyPressEvent(self, e):
        if e.key() == Qt.Key_Escape:
            self.close()

    def closeEvent(self, e):
        self.settings.setValue(self.__class__.__name__, self.saveGeometry())
        self.settings.setValue(SPLITTER, self.splitter.saveState())
        self.settings.setValue(CURRENT_DIRECTORY, self.current_directory)
        self.settings.setValue(LAST_FIGURE_TYPE, self.type.currentIndex())
        self.settings.setValue(SELECTED_IMAGE, self.imagesList.currentRow())


if __name__ == '__main__':
    # noinspection PyTypeChecker,PyCallByClass
    QApplication.setStyle(u'plastique')
    app = QApplication(sys.argv)

    main_window = MainWindow()
    main_window.show()

    sys.exit(app.exec_())
Exemplo n.º 18
0
        self.aboutQtButton = QPushButton("About Qt", self)
        self.aboutQtButton.move(130, 130)
        self.aboutQtButton.clicked.connect(self.showQtAbout)

    def showQtAbout(self):
        """ Function to show About Box
		"""
        QMessageBox.aboutQt(self.aboutQtButton, "About PySide")


###########################
if __name__ == '__main__':
    # Exception Handling
    try:
        myApp = QApplication(sys.argv)
        myApp.setStyle("macintosh")
        myWindow = SampleWindow()
        myWindow.setIcon()
        myWindow.setIconModes()
        myWindow.setButton()
        myWindow.setAboutButton()
        myWindow.setQtAboutButton()
        myWindow.show()
        myApp.exec_()
        sys.exit(0)
    except NameError:
        print("Name Error:", sys.exc_info()[1])
    except SystemExit:
        print("Closing Window...")
    except Exception:
        print(sys.exc_info()[1])
Exemplo n.º 19
0
        except RTMPError, e:
            print e


class Video(QWidget, Ui_VideoWidget):
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.setupUi(self)

        self.controlButton.clicked.connect(self.onControlButton)

    def onControlButton(self):
        self.streamThread = StreamThread()
        self.streamThread.start()

    def keyPressEvent(self, e):
        if e.key() == Qt.Key_Escape:
            self.close()


if __name__ == '__main__':
    # noinspection PyCallByClass
    QApplication.setStyle("plastique")
    app = QApplication(sys.argv)

    video = Video()
    video.show()

    sys.exit(app.exec_())
Exemplo n.º 20
0
    def figures_context_menu(self, point):
        print point

    def delete_figure(self):
        row = self.figures.currentRow()
        if row != -1:
            self.white_albatross.deleteFigure(row)
            self.figures.setCurrentRow(row)

    def keyPressEvent(self, e):
        if e.key() == Qt.Key_Escape:
            self.close()

    def closeEvent(self, e):
        self.settings.setValue(self.__class__.__name__, self.saveGeometry())
        self.settings.setValue(SPLITTER, self.splitter.saveState())
        self.settings.setValue(CURRENT_DIRECTORY, self.current_directory)
        self.settings.setValue(LAST_FIGURE_TYPE, self.type.currentIndex())
        self.settings.setValue(SELECTED_IMAGE, self.imagesList.currentRow())


if __name__ == '__main__':
    # noinspection PyTypeChecker,PyCallByClass
    QApplication.setStyle(u'plastique')
    app = QApplication(sys.argv)

    main_window = MainWindow()
    main_window.show()

    sys.exit(app.exec_())
Exemplo n.º 21
0
    #from srs.srsManager import srsScheduler

    #    srs = srsScheduler()
    #    srs.initializeAll()
    #    srs.db.addItemsToDb(18000, 29000)
    #    srs.initializeCurrentSession(100)
    #    srs.getNextItem()
    #    item = srs.getCurrentItem()
    #    example = srs.getCurrentExample()
    #    translation = srs.getCurrentSentenceTranslation()
    #    pass

    app = QApplication(sys.argv)

    quiz = Quiz()
    if quiz.options.isPlastique(): app.setStyle('plastique')
    quiz.setWindowIcon(QIcon('../res/icons/suzu.png'))

    about = About()
    options = OptionsDialog(quiz.srs.db, quiz.srs.db.frequency, quiz.options)
    #qdict = QuickDictionary(quiz.jmdict, quiz.edict, quiz.kjd, quiz.srs.db, quiz.options)

    #updater = BackgroundDownloader(quiz.options.getRepetitionInterval())
    #updater.start()
    qdict = ()
    updater = ()

    quiz.addReferences(about, options, qdict, updater)
    #    quiz.initGlobalHotkeys()

    try:
Exemplo n.º 22
0
def main():
    app=QApplication(sys.argv)
    app.setStyle("cleanlooks")
    im = client()
    im.show()
    sys.exit(app.exec_())
Exemplo n.º 23
0
		"""
		self.aboutQtButton = QPushButton("About Qt", self)
		self.aboutQtButton.move(130, 130)
		self.aboutQtButton.clicked.connect(self.showQtAbout)
	def showQtAbout(self):
		""" Function to show About Box
		"""
		QMessageBox.aboutQt(self.aboutQtButton, "About PySide")


###########################
if __name__ == '__main__':
	# Exception Handling
	try:
		myApp = QApplication(sys.argv)
		myApp.setStyle("macintosh")
		myWindow = SampleWindow()
		myWindow.setIcon()
		myWindow.setIconModes()
		myWindow.setButton()
		myWindow.setAboutButton()
		myWindow.setQtAboutButton()
		myWindow.show()
		myApp.exec_()
		sys.exit(0)
	except NameError:
		print("Name Error:", sys.exc_info()[1])
	except SystemExit:
		print("Closing Window...")
	except Exception:
		print(sys.exc_info()[1])
Exemplo n.º 24
0
def main():
    app = QApplication(sys.argv)
    app.setStyle('plastique')
    win = browserUI()
    win.show()
    sys.exit(app.exec_())
Exemplo n.º 25
0
    #from srs.srsManager import srsScheduler
    
#    srs = srsScheduler()
#    srs.initializeAll()
#    srs.db.addItemsToDb(18000, 29000)
#    srs.initializeCurrentSession(100)
#    srs.getNextItem()
#    item = srs.getCurrentItem()
#    example = srs.getCurrentExample()
#    translation = srs.getCurrentSentenceTranslation()
#    pass

    app = QApplication(sys.argv)
    
    quiz = Quiz()
    if quiz.options.isPlastique():  app.setStyle('plastique')
    quiz.setWindowIcon(QIcon('../res/icons/suzu.png'))
    
    about = About()
    options = OptionsDialog(quiz.srs.db, quiz.srs.db.frequency, quiz.options)
    #qdict = QuickDictionary(quiz.jmdict, quiz.edict, quiz.kjd, quiz.srs.db, quiz.options)
        
    #updater = BackgroundDownloader(quiz.options.getRepetitionInterval())
    #updater.start()
    qdict = (); updater = ()
    
    quiz.addReferences(about, options, qdict, updater)
#    quiz.initGlobalHotkeys() 
    
    try:
        sys.exit(app.exec_())