Esempio n. 1
0
    def splash(self):
        pixmap = QPixmap(".\\gui\\pyspec_less_ugly_shorter.png")
        smallerPixmap = pixmap.scaled(256, 256, Qt.KeepAspectRatio,
                                      Qt.SmoothTransformation)
        splash = QSplashScreen(smallerPixmap, Qt.WindowStaysOnTopHint)
        splash.setMask(smallerPixmap.mask())
        splash.setWindowFlag(Qt.WindowStaysOnTopHint)
        splash.show()
        self.processEvents()
        self.init_logging()
        self.processEvents()
        log.info("Initialization of views, models, controllers...")
        time.sleep(2)
        self.processEvents()
        self.mainModel = MainModel()
        self.mainCtrl = MainController()
        self.mainWindow = MainWindow(self.mainModel, self.mainCtrl)
        self.mainWindow.setWindowTitle("PySpec Software")
        self.mainWindow.setAttribute(Qt.WA_AlwaysStackOnTop)
        self.processEvents()
        log.info("Initialization completed.")
        self.processEvents()

        self.mainWindow.show()
        log.info("This is the MAIN THREAD")
Esempio n. 2
0
 def __init__(self, sys_argv):
     super(App, self).__init__(sys_argv)
     self.main_view = MainWindow()
     self.setAttribute(Qt.AA_EnableHighDpiScaling)
     self.setStyle("Fusion")
     self.setStyleSheet("")
     self.splash()
     self.main_view.show()
     self.main_view.setWindowTitle("PyGrapher")
Esempio n. 3
0
class App(QApplication):
    def __init__(self, sys_argv):
        super(App, self).__init__(sys_argv)
        self.main_view = MainWindow()
        self.setAttribute(Qt.AA_EnableHighDpiScaling)
        self.setStyle("Fusion")
        self.setStyleSheet("")
        self.splash()
        self.main_view.show()
        self.main_view.setWindowTitle("PyGrapher")

    def splash(self):
        pixmap = QPixmap("media/pyg-icon-7.png")
        smaller_pixmap = pixmap.scaled(300, 300, Qt.KeepAspectRatio, Qt.SmoothTransformation)
        splash = QSplashScreen(smaller_pixmap, Qt.WindowStaysOnTopHint)
        splash.show()
        time.sleep(3)
Esempio n. 4
0
def run():
    """ Run the developer GUI. """
    from gui.mainWindow import MainWindow
    from pgEngine.game import PirateGame
    from gui.resources import Resources
    from pgEngine.point import Point
    
    logFormat = '%(asctime)s  %(name)-30s %(levelname)-8s  %(message)s'
    logging.basicConfig(level=logging.DEBUG,
                        format=logFormat,
                        datefmt='%d-%m-%y %H:%M',
                        filename=os.path.join(os.environ["PGAME_LOGS"],
                                              'pgameDebugConsole.log'),
                        filemode='w')
    console = logging.StreamHandler()
    console.setLevel(1)
    formatter = logging.Formatter('%(name)-27s %(levelname)-8s %(message)s')
    console.setFormatter(formatter)
    #Comment this next line out to silence the console.
    logging.getLogger('').addHandler(console)

    res = Resources()
    game = PirateGame()
    
    game.ocean.load(res=res, mapName="map1.txt")
    
    game.addPlayer()
    game.ocean.moveItemTo(game.players[0].boats[0], Point(145.0, -80.0))
    game.addPlayer()
    game.ocean.moveItemTo(game.players[1].boats[0], Point(150.0, -75.0))
    game.start()

    mainWindow = MainWindow(gameObj=game, resources=res)
    mainWindow.run()
    
    game.ocean.save(res=res, mapName="map1.txt")
Esempio n. 5
0
#!/usr/bin/env python
# This work is licensed under the Creative Commons Attribution-NonCommercial-
# ShareAlike 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative
# Commons, PO Box 1866, Mountain View, CA 94042, USA.

import sys
import argparse
from gui.mainWindow import MainWindow
from PyQt4 import QtGui

qApp = QtGui.QApplication(sys.argv)

parser = argparse.ArgumentParser(prog='CoatingGUI.py')
parser.add_argument('-p',
                    '--project',
                    help='open CoatingGUI project file PROJECT')
args = parser.parse_args()
Window = MainWindow(vars(args))
Window.show()
qApp.exec_()
Esempio n. 6
0
import sys

from gui.mainWindow import MainWindow
from PyQt5.QtWidgets import QApplication

if __name__ == '__main__':
    app = QApplication(sys.argv)
    desktop = QApplication.desktop()
    window = MainWindow(desktop)
    window.show()
    sys.exit(app.exec_())
Esempio n. 7
0
class App(QApplication):
    def __init__(self, sys_argv):
        super(App, self).__init__(sys_argv)

        sys.excepthook = self.handle_exception
        self.init_logging()
        self.setAttribute(Qt.AA_EnableHighDpiScaling)
        self.setStyle("Fusion")
        self.splash()

    def splash(self):
        pixmap = QPixmap(".\\gui\\pyspec_less_ugly_shorter.png")
        smallerPixmap = pixmap.scaled(256, 256, Qt.KeepAspectRatio,
                                      Qt.SmoothTransformation)
        splash = QSplashScreen(smallerPixmap, Qt.WindowStaysOnTopHint)
        splash.setMask(smallerPixmap.mask())
        splash.setWindowFlag(Qt.WindowStaysOnTopHint)
        splash.show()
        self.processEvents()
        self.init_logging()
        self.processEvents()
        log.info("Initialization of views, models, controllers...")
        time.sleep(2)
        self.processEvents()
        self.mainModel = MainModel()
        self.mainCtrl = MainController()
        self.mainWindow = MainWindow(self.mainModel, self.mainCtrl)
        self.mainWindow.setWindowTitle("PySpec Software")
        self.mainWindow.setAttribute(Qt.WA_AlwaysStackOnTop)
        self.processEvents()
        log.info("Initialization completed.")
        self.processEvents()

        self.mainWindow.show()
        log.info("This is the MAIN THREAD")

    @staticmethod
    def init_logging():
        logger = logging.getLogger()
        logger.setLevel(logging.NOTSET)

        # create console handler
        handler = logging.StreamHandler()
        handler.setLevel(logging.INFO)
        formatter = logging.Formatter(
            "%(asctime)s\t\t (%(name)-15.15s) (thread:%(thread)d) (line:%(lineno)5d)\t\t[%(levelname)-5.5s] %(message)s"
        )
        handler.setFormatter(formatter)
        logger.addHandler(handler)

        # create debug file handler in working directory
        paramsViewUiPath = os.path.dirname(
            os.path.realpath(__file__)) + "\\paramsViewUi.ui"
        handler = RotatingFileHandler(
            os.path.dirname(os.path.realpath(__file__)) +
            "\\log\\fbg-interfero.log",
            maxBytes=2.3 * 1024 * 1024,
            backupCount=5)
        handler.setLevel(logging.ERROR)
        formatter = logging.Formatter(
            "%(asctime)s\t\t (%(name)-25.25s) (thread:%(thread)d) (line:%(lineno)5d)\t\t[%(levelname)-5.5s] %(message)s"
        )
        handler.setFormatter(formatter)
        logger.addHandler(handler)

    @staticmethod
    def handle_exception(exc_type, exc_value, exc_traceback):
        if issubclass(exc_type, KeyboardInterrupt):
            sys.__excepthook__(exc_type, exc_value, exc_traceback)
            return

        log.error("Uncaught exception",
                  exc_info=(exc_type, exc_value, exc_traceback))
Esempio n. 8
0


# File dialog
fileOpener = FileOpener()

if not fileOpener.configure_traits():
    sys.exit()


# data preperation
dm = DataManager(fileOpener.log_files, fileOpener.esf_files)


## Create project
mainWindow = MainWindow()

plotGlue = plotGlue.PlotGlue(mainWindow,dm)
exportGlue = exportGlue.ExportGlue(dm)


project = treeGlue.createProject(dm,plotGlue,exportGlue)

if _debug: print str(project)


## run main


# def onSelect(obj):
#     pass
Esempio n. 9
0
# -*- coding: utf-8 -*-

from gui.mainWindow import MainWindow
from gui.chooseFaceDetectionModel import chooseFaceDetectionModelDialog
from PyQt4 import QtCore, QtGui

if __name__ == "__main__":
    import sys
    app = QtGui.QApplication(sys.argv)
    MainWindow = MainWindow()
    MainWindow.show()
    sys.exit(app.exec_())
Esempio n. 10
0
import sys
#quit when ctrl+c is pressed in console
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)

from PyQt5.QtWidgets import QApplication

from gui.mainWindow import MainWindow
"""
@TODO
    - do not use '../' to find file path of settings file
    - when error occured, stop thread until message box is closed
    - make exposure setable by texbox
"""

if __name__ == '__main__':
    app = QApplication(sys.argv)
    app.setStyleSheet(open('resources/pyQtStyleSheet.css').read())

    win = MainWindow()
    # win.showMaximized()
    win.showFullScreen()
    win.setWindowTitle("Cell Counter")
    sys.exit(app.exec_())
Esempio n. 11
0
# -*- coding: utf-8 -*-

import sys
from gui.mainWindow import MainWindow
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtCore import Qt

if __name__ == '__main__':

    app = QApplication(sys.argv)
    w = MainWindow()

    sys.exit(app.exec_())
Esempio n. 12
0
def main():
    app = QtGui.QApplication(sys.argv)
    if login(): 
        win = MainWindow()
        win.show()
        sys.exit(app.exec_())
Esempio n. 13
0
 def __initGUI__(self):
     print('init gui')
     self.mainWindow = MainWindow(self)
     if not self.existingFile(self.optionfile):
         self.pressoptions()
     else: self.loadoption()
Esempio n. 14
0
class MainController(object):
    '''
    classdocs
    '''


    def __init__(self):
        '''
        Constructor
        '''
        self.option = Option( )
        self.searchOptionFile()
        self.__initGUI__()
        self.time = 0
        
    def searchOptionFile(self):
        '''
        Search Option-File
        If not exist create path
        '''
        home = os.environ['HOME']
        
        self.optionfile = home+'/Documents/.PasswordSafe/option.xml'
        
        self.dirfile = os.path.dirname(self.optionfile)
        if not os.path.exists(self.dirfile):
            os.makedirs(self.dirfile)
        print(str(self.dirfile)) 
    
    def existingFile(self, filename):
        retVal = False
        if os.path.isfile(filename):
            retVal = True
        return retVal   
    
    def __initGUI__(self):
        print('init gui')
        self.mainWindow = MainWindow(self)
        if not self.existingFile(self.optionfile):
            self.pressoptions()
        else: self.loadoption()
        
    def pressmainLock(self):
        print('locking screen')
        self.settimezero()
        self.mainWindow.hideUnlockFrame()
        self.mainWindow.setlockframe()
        self.mainWindow.setAccount(self.option.getEmail())
    
    def pressmainUnlock(self, passphrase):
        print('try to unlock screen')
        try:
            self.passsafe = PasswordSafe(self.option)
            self.passsafe.load(passphrase)
            self.filter = PassSafeFilter(self.passsafe.getSafe())
            self.mainWindow.hideLockFrame()
            self.filter.doFilter()
            self.mainWindow.setunlockframe()
            print('unlock complete')
            self.mainWindow.insertTitleBox(self.filter.getFilteredpasssafe())
            if 0 != self.option.gui.autolock:
                self.startTimeControl()
            self.settimeback()
        except:
            print sys.exc_info()
            self.mainWindow.setlabelpassphrase()
            
    def pressoptions(self):
        self.settimeback()
        print('open options')
        self.optionwindow = OptionWindow(self.option, self)
        self.optionwindow.show()
        
    def pressOptionSave(self):
        print('save options')
        writer = OptionWriter()
        writer.write(self.option, self.optionfile)
        self.loadoption()
        #do we need to start the autolock?
        # might be it is already started
        # --> take self.time to decide whether autolock is started
        if 0 == self.time and None != self.mainWindow.getunlockframe() and 0 != self.option.gui.autolock:
            self.startTimeControl()
        self.settimeback()
        
    def controlOptionSave(self):
        
        if self.mainWindow.getunlockframe() == None:
            self.pressOptionSave()
        elif self.mainWindow.getlockframe() == None:
            if self.option.getEmail() != self.option.getEmailOld():
                self.pressmainLock()
                self.pressOptionSave()
            else:
                self.pressOptionSave()
    
    def pressnewpass(self):
        print('open newpassword')
        self.settimeback()
        self.newpasswindow = NewPassWindow(self)
        self.newpasswindow.show()
        
    def presschangepass(self, index):
        self.settimeback()
        print('open changepassword')
        
        passObFilter = self.filter.getFilteredpasssafe()[index]
        indexSafe = 0
        for passObSafe in self.passsafe.getSafe():
            if passObFilter == passObSafe:
                break
            indexSafe += 1
        title = self.passsafe.getTitle(indexSafe)
        username = self.passsafe.getUsername(indexSafe)
        password = self.passsafe.getPassword(indexSafe)
        email = self.passsafe.getEmail(indexSafe)
        location = self.passsafe.getLocation(indexSafe)
        note = self.passsafe.getNote(indexSafe)
        self.changepass = ChangePassWindow(self, indexSafe, title, username, password, email, location, note)
            
    def pressnewpasssave(self, title, username, password, email, location, note):
        print('save new password')
        self.passsafe.newPassObject(title, username, password, email, location, note)
        self.filter = PassSafeFilter(self.passsafe.getSafe())
        self.filter.doFilter() 
        self.mainWindow.insertTitleBox(self.filter.getFilteredpasssafe())
        self.settimeback()
        
    def presschangepasssave(self, index, title, username, password, email, location, note):
        print('save passwordchanges')
        self.passsafe.changePassOb(index, title, username, password, email, location, note)
        self.filter = PassSafeFilter(self.passsafe.getSafe())
        self.filter.doFilter()
        self.mainWindow.insertTitleBox(self.filter.getFilteredpasssafe())
        self.settimeback()
    
    def pressremovepass(self, index):
        print('password deleted')
        
        passObFilter = self.filter.getFilteredpasssafe()[index]
        for passObSafe in self.passsafe.getSafe():
            if passObFilter == passObSafe:
                self.passsafe.removePassOb(passObSafe)
        

        self.filter = PassSafeFilter(self.passsafe.getSafe())
        self.filter.doFilter()
        self.mainWindow.insertTitleBox(self.filter.getFilteredpasssafe())
        self.settimeback()
        
    def pressViewHistory(self, index):
        history = self.filter.getFilteredpasssafe()[index].getHistory()
        self.viewHistory = ViewHistory(self, self.mainWindow, history)
        self.viewHistory.show()
        
    def pressCopy(self, entry):
        self.mainWindow.mainWindow.clipboard_clear()
        self.mainWindow.mainWindow.clipboard_append(entry)
        
    def pressAbout(self):
        self.aboutFrame = AboutFrame()
    
    def loadoption(self):
        print('loadoptions')
        self.optionloader = OptionLoader(self.optionfile, self)
        self.optionloader.loadOptions(self.optionfile, self.option)
        self.accounts = self.optionloader.getaccounts()
        self.account = self.option.getEmail()
        self.mainWindow.setAccount(self.account)
    
    def loadPassOb(self, index):
        print('load PasswordObject')
        title = self.filter.getTitle(index)
        username = self.filter.getUsername(index)
        password = self.filter.getPassword(index)
        email = self.filter.getEmail(index)
        location = self.filter.getLocation(index)
        note = self.filter.getNote(index)
        
        title = self.controlNone(title)
        username = self.controlNone(username)
        password = self.controlNone(password)
        email = self.controlNone(email)
        location = self.controlNone(location)
        note = self.controlNone(note)
        
        self.mainWindow.setfills(title, username, password, email, location, note)
        self.settimeback()
        
    def controlNone(self, attr):
        if (attr == None) or (attr == 'None'):
            retVal = ''
        else:
            retVal = attr 
        return retVal
    
    def startTimeControl(self):
        self.mainWindow.getmainwindow().after(1000, self.timecontrol)

    def timecontrol(self):
        # we need to check the autolock every time because it might be changed in option dialog while
        # a self.timecontrol was queued
        if 0 != self.option.gui.autolock:
            self.time -= 1
            print self.time
            if self.time <= 0:
                if self.time !=-1:
                    self.pressmainLock()
            else:
                self.mainWindow.setTime(self.time)
                self.mainWindow.getmainwindow().after(1000, self.timecontrol)
        else:
            self.mainWindow.setTime(None)
            
    def updatefilter(self, filterstring='', filterattribute=[]):
        self.filter.setFilterstring(filterstring)
        self.filter.setFilterattribute(filterattribute)
        self.filter.doFilter()
        self.mainWindow.insertTitleBox(self.filter.getFilteredpasssafe())
        self.settimeback()
    
    def settimeback(self):
        self.time = self.option.gui.autolock
        
    def settimezero(self):
        self.time = 0
       
    def show(self):
        self.mainWindow.show()
Esempio n. 15
0
#!/usr/bin/env python
# This work is licensed under the Creative Commons Attribution-NonCommercial-
# ShareAlike 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative
# Commons, PO Box 1866, Mountain View, CA 94042, USA.

import sys
import argparse
from gui.mainWindow import MainWindow
from PyQt4 import QtGui

qApp = QtGui.QApplication(sys.argv)

parser = argparse.ArgumentParser(prog='CoatingGUI.py')
parser.add_argument('-p', '--project', help='open CoatingGUI project file PROJECT')
args = parser.parse_args()
Window = MainWindow(vars(args))
Window.show()
qApp.exec_()
import sys

from PyQt5 import QtWidgets

from gui.mainWindow import MainWindow

app = QtWidgets.QApplication(sys.argv)
playerWindow = MainWindow()
playerWindow.show()
app.aboutToQuit.connect(playerWindow.exit)
sys.exit(app.exec_())