コード例 #1
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)
コード例 #2
0
ファイル: CoatingGUI.py プロジェクト: wagnervd/dielectric
#!/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_()
コード例 #3
0
ファイル: Main.py プロジェクト: Fake-ignat/color_table
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_())
コード例 #4
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))
コード例 #5
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_())
コード例 #6
0
ファイル: pwdmngr.py プロジェクト: zhyu/PasswdManager
def main():
    app = QtGui.QApplication(sys.argv)
    if login(): 
        win = MainWindow()
        win.show()
        sys.exit(app.exec_())
コード例 #7
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()
コード例 #8
0
ファイル: CoatingGUI.py プロジェクト: SeanDS/CoatingGUI
#!/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_()
コード例 #9
0
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_())