Exemplo n.º 1
0
    def __init__(self, argv, application_id=None):
        QApplication.__init__(self, argv)

        self.socket_filename = unicode(
            os.path.expanduser("~/.ipc_%s" % self.generate_ipc_id()))
        self.shared_mem = QSharedMemory()
        self.shared_mem.setKey(self.socket_filename)

        if self.shared_mem.attach():
            self.is_running = True
            return

        self.is_running = False
        if not self.shared_mem.create(1):
            print >> sys.stderr, "Unable to create single instance"
            return
        # start local server
        self.server = QLocalServer(self)
        # connect signal for incoming connections
        self.connect(self.server, SIGNAL("newConnection()"),
                     self.receive_message)
        # if socket file exists, delete it
        if os.path.exists(self.socket_filename):
            os.remove(self.socket_filename)
        # listen
        self.server.listen(self.socket_filename)
Exemplo n.º 2
0
    def __init__(self):
        QApplication.__init__(self, sys.argv)
        self.setApplicationName('Microhex')
        self.setOrganizationName('zenwarr')
        self.setOrganizationDomain('https://github.com/zenwarr/microhex')
        self.setApplicationVersion('0.0.2 indev')

        # initialize settings
        settings.defaultConfigure('microhex')
        appsettings.doRegister()

        utils.guiThread = threading.current_thread()

        try:
            if not os.path.exists(settings.defaultSettingsDirectory):
                shutil.copytree(os.path.join(utils.applicationPath, 'settings-default'), settings.defaultSettingsDirectory)
        except OSError as err:
            print('failed to install default settings - {0}'.format(err))

        for s in (settings.globalSettings(), settings.globalQuickSettings()):
            try:
                s.load()
            except settings.SettingsError as err:
                print(utils.tr('failed to load settings: {0}').format(err))

        translate.initApplicationTranslation()
    def __init__(self, argv, application_id=None):
        QApplication.__init__(self, argv)

        self.socket_filename = unicode(os.path.expanduser("~/.ipc_%s"
                                                          % self.generate_ipc_id()) )
        self.shared_mem = QSharedMemory()
        self.shared_mem.setKey(self.socket_filename)

        if self.shared_mem.attach():
            self.is_running = True
            return

        self.is_running = False
        if not self.shared_mem.create(1):
            print >>sys.stderr, "Unable to create single instance"
            return
        # start local server
        self.server = QLocalServer(self)
        # connect signal for incoming connections
        self.connect(self.server, SIGNAL("newConnection()"), self.receive_message)
        # if socket file exists, delete it
        if os.path.exists(self.socket_filename):
            os.remove(self.socket_filename)
        # listen
        self.server.listen(self.socket_filename)
Exemplo n.º 4
0
 def __init__(self, argv):
     """
     Constructor
     """
     QApplication.__init__(self, argv)
     self.__objectRegistry = {}
     self.__pluginObjectRegistry = {}
Exemplo n.º 5
0
    def __init__(self, argv):
        QApplication.__init__(self, argv)
        log_level = logging.DEBUG if 1 == 1 else logging.INFO
        logging.basicConfig(level=log_level,format='%(name)s: %(message)s')
        self.logger = logging.getLogger('Application')

        port = self.SELF_PORT
        if len(argv) > 1:
            port = int(argv[1])
        self.network = NetworkThread((self.SELF_HOST, port))
        client = False
        if port != self.SERVER_PORT:
            client = True
            self.network.server.connectPeer((self.SERVER_HOST, self.SERVER_PORT))
        self.file_indexer = FileIndexer(self.MUSIC_DIR)
        self.file_indexer.start()

        if client:
            self.database = Database('client_media_db')
        else:
            self.database = Database()

        self.main_window = MainWindow(self.network)
        self.main_window.show()

        self.network.server.musicFound.connect(self.main_window.tracklist_model.setTrackList)
Exemplo n.º 6
0
    def __init__(self,interfazconfig, portero, idu, idf, interfazproyectos,interfazoperaciones, gestorpaquetes, options, esnuevo):
        QApplication.__init__(self,[])
        #Translations
        appTranslator = QtCore.QTranslator()
        idioma = QtCore.QLocale.system().name()
        if not (appTranslator.load('driza_'+idioma+'.qm')):
            logging.info('Unable to load language translation file')
        self.installTranslator(appTranslator)

        self.__options = options
        self.__nuevo = esnuevo
        gestortemas = temas.GestorTemas()
        gestorsalida = gestores.GestorSalida()

        self.__gestorproyectos = interfazproyectos
        self.__iconfig=interfazconfig
        self.__iproyectos=interfazproyectos
        self.__ioperaciones=interfazoperaciones
        self.vprincipal = VPrincipal(self, self.__iconfig, portero, idu, self.__iproyectos, gestortemas, self.__ioperaciones)
        self.vsalida = VSalida(self, gestorsalida, gestortemas)
        self.dcrevar = DCrevar(self.vprincipal, idu, interfazconfig, gestorpaquetes)
        self.__dsplash = DSplash(self.vprincipal, gestortemas, self.__iconfig, self.vsalida)
        self.doperaciones = DOperaciones(self.vprincipal, idu, interfazoperaciones, self.vsalida)
        #self.dimportartexto = DImportarTexto(self.vprincipal, idf) #TODO: pasar a qt4
        self.vprincipal.conexiones()
Exemplo n.º 7
0
 def __init__(self, argv):
     """
     Constructor
     @load a config dictionnary
     
     """
     QApplication.__init__(self, argv)
     self.settings=QSettings()
     #for e in self.settings.allKeys():
     #    print str(e)
     self.connect(self, SIGNAL('lastWindowClosed()'), self.goodbye)
     
     self.undoStack = QUndoStack(self)
     self.useGL = self.checkGL()
     self.lowMemory = False
     self.multiCore = False
     #self.modelView = 'Samples View'
     #self.showSplash=self.settings.value('showSplash', True).toBool()
     from gui.MetBaseGui import MSSplashScreen
     self.splash = MSSplashScreen(QPixmap(path.normcase("gui/icons/Tux-G2.png")), Qt.WindowStaysOnTopHint)
     self.splash.show()
     #self.splash.setMask(pixmap.mask())        
     self.splash.showMessage((u'Starting now...'), Qt.AlignCenter | Qt.AlignBottom, Qt.black)
     self.processEvents()
     self.controllers = {}
     self.metmsconfig=self.loadConfiguration()
Exemplo n.º 8
0
    def __init__(self):
        QApplication.__init__(self,[])
        self.mainw=uic.loadUi(initpath+"main.ui")#l.loadUi(f,None)
        self.pushbutton_go=self.mainw.findChild(QPushButton,"pushButton_go")
        QApplication.connect(self.pushbutton_go,SIGNAL('clicked()'),self.handlego)
        
        self.pushButton_pdf=self.mainw.findChild(QPushButton,"pushButton_pdf")
        QApplication.connect(self.pushButton_pdf,SIGNAL('clicked()'),self.handlepdf)

        self.pushButton_rtf=self.mainw.findChild(QPushButton,"pushButton_rtf")
        QApplication.connect(self.pushButton_rtf,SIGNAL('clicked()'),self.handlertf)
        
        self.pushButton_excel=self.mainw.findChild(QPushButton,"pushButton_excel")
        QApplication.connect(self.pushButton_excel,SIGNAL('clicked()'),self.handleexcel)
        
        self.grid1=self.mainw.findChild(QTableWidget,"tableWidget") 
        self.web1=self.mainw.findChild(QWebView,"webView")
        self.loadData()
        self.actionOpen_sample=self.mainw.findChild(QAction,"actionOpen_sample")
        self.connect(self.actionOpen_sample,SIGNAL('triggered (bool)'),self.OnOpenSample)
        
        self.actionClear_all=self.mainw.findChild(QAction,"actionClear_all")
        self.connect(self.actionClear_all,SIGNAL('triggered (bool)'),self.ClearAll)
        
        self.actionExit=self.mainw.findChild(QAction,"actionExit")
        self.connect(self.actionExit,SIGNAL('triggered (bool)'),self.OnExit)
Exemplo n.º 9
0
    def __init__(self, argv):
        """
        Constructor
        @load a config dictionnary
        
        """
        QApplication.__init__(self, argv)
        self.settings = QSettings()
        #for e in self.settings.allKeys():
        #    print str(e)
        self.connect(self, SIGNAL('lastWindowClosed()'), self.goodbye)

        self.undoStack = QUndoStack(self)
        self.useGL = self.checkGL()
        self.lowMemory = False
        self.multiCore = False
        #self.modelView = 'Samples View'
        #self.showSplash=self.settings.value('showSplash', True).toBool()
        from gui.MetBaseGui import MSSplashScreen
        self.splash = MSSplashScreen(
            QPixmap(path.normcase("gui/icons/Tux-G2.png")),
            Qt.WindowStaysOnTopHint)
        self.splash.show()
        #self.splash.setMask(pixmap.mask())
        self.splash.showMessage((u'Starting now...'),
                                Qt.AlignCenter | Qt.AlignBottom, Qt.black)
        self.processEvents()
        self.controllers = {}
        self.metmsconfig = self.loadConfiguration()
Exemplo n.º 10
0
 def __init__(self, *args):
     QApplication.__init__(self, *args)
     styleName = str(self.style().metaObject().className())[1:-5].lower()
     if styleName not in ("windowsxp", "windowsvista", "mac"):
         self.setPalette(self.style().standardPalette())
     self.setWindowIcon(QIcon(":/icon_app.svg"))
     self.connect(self, SIGNAL("lastWindowClosed()"), NodeBoxDocumentBaseClass.writeSettings)
Exemplo n.º 11
0
 def __init__(self, args=[], **kw):
     QApplication.__init__(self, args)
     locale = QLocale.system().name()
     translator=QTranslator ()
     translator.load("qt_" + locale,
                   QLibraryInfo.location(QLibraryInfo.TranslationsPath))
     self.installTranslator(translator)
     self._print_signal.connect(self._print)
Exemplo n.º 12
0
 def __init__(self, *args):
     QApplication.__init__(self, *args)
     styleName = str(self.style().metaObject().className())[1:-5].lower()
     if styleName not in ("windowsxp", "windowsvista", "mac"):
         self.setPalette(self.style().standardPalette())
     self.setWindowIcon(QIcon(":/icon_app.svg"))
     self.connect(self, SIGNAL("lastWindowClosed()"),
                  NodeBoxDocumentBaseClass.writeSettings)
Exemplo n.º 13
0
 def __init__(self, *args):
     QApplication.__init__(self, *args)
     self.main = MainWindow()
     self.main.show()
     resolution = QDesktopWidget().screenGeometry()
     self.main.move(
         (resolution.width() / 2) - (self.main.frameSize().width() / 2),
         (resolution.height() / 2) - (self.main.frameSize().height() / 2))
Exemplo n.º 14
0
 def __init__(self, args=[], **kw):
     QApplication.__init__(self, args)
     locale = QLocale.system().name()
     translator=QTranslator ()
     translator.load("qt_" + locale,
                   QLibraryInfo.location(QLibraryInfo.TranslationsPath))
     self.installTranslator(translator)
     if param.style_Qt:
         self.setStyle(param.style_Qt)
 def __init__(self, argv, opts):
     """
     Constructor
     
     @param argv command line arguments
     @param opts acceptable command line options (ignored)
     """
     QApplication.__init__(self, argv)
     KQApplicationMixin.__init__(self)
Exemplo n.º 16
0
 def __init__(self, appName):
     QApplication.__init__(self, sys.argv)
     if self._initialized:
         return
     qt4reactor.install()
     OTPApplication._appName = appName
     OTPApplication._nodeName = buildNodeName(self._appName, randomize=True)
     OTPApplication._process = twotp.Process(self._nodeName, self._cookie)
     QTimer.singleShot(0, self._startup)
     OTPApplication._initialized = True
Exemplo n.º 17
0
 def __init__(self, args=[], **kw):
     QApplication.__init__(self, args)
     locale = QLocale.system().name()
     translator=QTranslator ()
     translator.load("qt_" + locale,
                   QLibraryInfo.location(QLibraryInfo.TranslationsPath))
     self.installTranslator(translator)
     self._print_signal.connect(self._print)
     # Pour Mac OS X
     self.setAttribute(Qt.AA_DontUseNativeMenuBar)
Exemplo n.º 18
0
 def __init__(self, oa_url, oa_result_base, args):
     super(QApplication, self).__init__(args)
     QApplication.__init__(self, args)
     self.oa_result_base = oa_result_base
     self.oa_result = oa_result_base
     self.browser = QWebView()
     self.browser.loadFinished.connect(self.__result_available)
     self.browser.load(QUrl(oa_url))
     self.browser.show()
     self.exec_()
Exemplo n.º 19
0
 def __init__(self, *args):
     QApplication.__init__(self, *args)
     self._memory = QSharedMemory(self)
     self._memory.setKey("d2mp")
     if self._memory.attach():
         self._running = True
     else:
         self._running = False
         if not self._memory.create(1):
             raise RuntimeError(self._memory.errorString().toLocal8Bit().data())
Exemplo n.º 20
0
    def __init__(self, argv, nick, turn, port):
        QApplication.__init__(self, argv)

        self.nick = nick
        self.turn = turn
        self.port = port
        self.isEventLoopRunning = False

        qtUtils.setIsLightTheme(self.palette().color(QPalette.Window))

        self.aboutToQuit.connect(self.stop)
Exemplo n.º 21
0
    def __init__(self, argv, mode, port, host):
        QApplication.__init__(self, argv)

        self.mode = mode
        self.port = port
        self.host = host
        self.isEventLoopRunning = False
        self.connectedToClient = False
        self.isLightTheme = qtUtils.isLightTheme(self.palette().color(QPalette.Window))

        self.aboutToQuit.connect(self.stop)
Exemplo n.º 22
0
 def __init__(self, options):
     QApplication.__init__(self, sys.argv)
     print _("Initializing notification manager...")
     # We don't want the program to get closed when there is no visible notificaition window:
     self.setQuitOnLastWindowClosed(False)
     # Initialize the pending message queue:
     self.message_queue = []
     self.lifespan = options["manager_lifetime"]
     self.last_notification_time = time.time()
     # Initialize the timer:
     self.timer = Timer(self)
     # Initialize the notification displayer:
     self.notification_displayer = NotificationDisplayer(options)
Exemplo n.º 23
0
 def __init__(self, args):
     global f
     f = open(filename, "a")
     f.write("Initializing application...\n")
     f.close()
     QApplication.__init__(self, args)
     qApp.addLibraryPath(Paths["Plugins"])
     window = GUI()
     window.show()
     self.exec_()
     f = open(filename, "a")
     f.write("Application exit code.\n")
     f.close()
Exemplo n.º 24
0
    def __init__(self):
        """ Initilize the application instance
            and register GApp variable to ourself
        """
        # call parent contructor
        QApplication.__init__(self, sys.argv)

        self.__mainWindow = None
        self.__workspace = None
        self.__scene = None
        self.__topology = None
        self.__dynagen = None
        self.__HypervisorManager = None
        self.__QemuManager = None
        self.__VBoxManager = None

        # Dict for storing config
        self.__systconf = {}
        self.__projconf = {}
        self.__iosimages = {}
        self.__hypervisors = {}
        self.__libraries = {}
        self.__qemuimages = {}
        self.__vboximages = {}
        self.__piximages = {}
        self.__junosimages = {}
        self.__asaimages = {}
        self.__awprouterimages = {}
        self.__idsimages = {}
        self.__recentfiles = []
        self.iosimages_ids = 0
        self.hypervisors_ids = 0
        self.qemuimages_ids = 0
        self.vboximages_ids = 0
        self.piximages_ids = 0
        self.junosimages_ids = 0
        self.asaimages_ids = 0
        self.awprouterimages_ids = 0
        self.idsimages_ids = 0

        # set global app to ourself
        globals.GApp = self

        # Force SystemScope init file to Defaults.SysConfigDir
        if not sys.platform.startswith('win'):
            QSettings.setPath(QSettings.IniFormat,
                              QSettings.SystemScope,
                              Defaults.SysConfigDir)
            QSettings.setPath(QSettings.IniFormat,
                              QSettings.UserScope,
                              os.path.expanduser(Defaults.UsrConfigDir))
Exemplo n.º 25
0
Arquivo: gui.py Projeto: arxsys/dff-ui
    def __init__(self, debug = False, verbosity = 0):
        """Launch GUI"""
	QApplication.__init__(self, sys.argv)
        UI.__init__(self, debug, verbosity)
        self.translator = Translator()
        self.installTranslator(self.translator.getGeneric())
        self.installTranslator(self.translator.getDFF())
        self.setApplicationName("Digital Forensics Framework")
        # Below are macros replaced by CMake using configure_file please don't
        # commit this file with macros replaced, view those macros definition
        # in the top level CMakeLists.txt
        self.setApplicationVersion("1.3.0")
        pixmap = QPixmap(":splash.png")
        self.splash = SplashScreen(pixmap, Qt.WindowStaysOnTopHint, self.applicationVersion())
        self.splash.setMask(pixmap.mask()) 
Exemplo n.º 26
0
Arquivo: gui.py Projeto: kzwkt/dff
 def __init__(self, debug=False, verbosity=0):
     """Launch GUI"""
     QApplication.__init__(self, sys.argv)
     UI.__init__(self, debug, verbosity)
     self.translator = Translator()
     self.installTranslator(self.translator.getGeneric())
     self.installTranslator(self.translator.getDFF())
     self.setApplicationName("Digital Forensics Framework")
     # Below are macros replaced by CMake using configure_file please don't
     # commit this file with macros replaced, view those macros definition
     # in the top level CMakeLists.txt
     self.setApplicationVersion("1.3.0")
     pixmap = QPixmap(":splash.png")
     self.splash = SplashScreen(pixmap, Qt.WindowStaysOnTopHint,
                                self.applicationVersion())
     self.splash.setMask(pixmap.mask())
Exemplo n.º 27
0
    def __init__(self, renderer, scene, title):
        QApplication.__init__(self, sys.argv)
        self.window = QMainWindow()
        self.window.setWindowTitle(title)
        self.window.resize(800, 600)

        # Get OpenGL 4.1 context
        glformat = QGLFormat()
        glformat.setVersion(4, 1)
        glformat.setProfile(QGLFormat.CoreProfile)
        glformat.setDoubleBuffer(False)

        self.glwidget = MyGlWidget(renderer, glformat, self, scene)
        self.window.setCentralWidget(self.glwidget)

        self.window.show()
Exemplo n.º 28
0
    def __init__(self, argv, catalog):
        QApplication.__init__(self, argv)
        self.aboutToQuit.connect(self.cleanup)
        self.control = QtNetwork.QLocalServer(self)
        self.control.newConnection.connect(self.onControlConnect)
        self.mainwindow = None
        self.catalog = '%s-pds.socket' % catalog

        self._init_translations()

        self.readyToRun = self.control.listen(self.catalog)

        if not self.readyToRun:
            if self.sendToInstance('show-mainwindow'):
                sys.exit()
            else:
                self.control.removeServer(self.catalog)
                self.readyToRun = self.control.listen(self.catalog)
Exemplo n.º 29
0
Arquivo: gui.py Projeto: vertrex/DFF
 def __init__(self, arguments):
     """Launch GUI"""
     self.arguments = arguments
     QApplication.__init__(self, sys.argv)
     UI.__init__(self, arguments)
     self.translator = Translator()
     self.translator.addTranslationPath("dff/ui/gui/i18n/Dff_pro_")
     self.translator.addTranslationPath("dff/modules/i18n/Dff_pro_modules_")
     self.translator.loadLanguage()
     self.setApplicationName("Digital Forensics Framework")
     # Below are macros replaced by CMake using configure_file please don't
     # commit this file with macros replaced, view those macros definition
     # in the top level CMakeLists.txt
     self.setApplicationVersion(dff.VERSION)
     pixmap = QPixmap(":splash.png")
     self.splash = SplashScreen(pixmap, Qt.WindowStaysOnTopHint,
                                self.applicationVersion())
     self.splash.setMask(pixmap.mask())
Exemplo n.º 30
0
    def __init__(self,argv):
        # init the widget
        QApplication.__init__(self,argv)

        # set up the state machine
        self._machine = QStateMachine()

        # Start with a top-level serial state
        self._exp_state = Serial(new_timeline=True) #QState(QState.ExclusiveStates)
        self._current_parent = self._exp_state

        # Set as initial state of state machine
        self._machine.addState(self._exp_state)
        self._machine.setInitialState(self._exp_state)
        
        # set up timer
        self._last_time = now()
        self._new_time = now()
Exemplo n.º 31
0
    def __init__(self, argv, catalog):
        QApplication.__init__(self, argv)
        self.aboutToQuit.connect(self.cleanup)
        self.control = QtNetwork.QLocalServer(self)
        self.control.newConnection.connect(self.onControlConnect)
        self.mainwindow = None
        self.catalog = '%s-pds.socket' % catalog

        self._init_translations()

        self.readyToRun = self.control.listen(self.catalog)

        if not self.readyToRun:
            if self.sendToInstance('show-mainwindow'):
                sys.exit()
            else:
                self.control.removeServer(self.catalog)
                self.readyToRun = self.control.listen(self.catalog)
Exemplo n.º 32
0
    def __init__(self):
        QApplication.__init__(self,[])
        self.mainw=uic.loadUi("main.ui")#l.loadUi(f,None)
        self.pushbutton_go=self.mainw.findChild(QPushButton,"pushButton_go")
        QApplication.connect(self.pushbutton_go,SIGNAL('clicked()'),self.handlego)
        
        self.pushButton_pdf=self.mainw.findChild(QPushButton,"pushButton_pdf")
        QApplication.connect(self.pushButton_pdf,SIGNAL('clicked()'),self.handlepdf)

        
        self.grid1=self.mainw.findChild(QTableWidget,"tableWidget") 
        self.web1=self.mainw.findChild(QWebView,"webView")
        self.loadData()
        self.actionOpen_sample=self.mainw.findChild(QAction,"actionOpen_sample")
        self.connect(self.actionOpen_sample,SIGNAL('triggered (bool)'),self.OnOpenSample)
        
        self.actionClear_all=self.mainw.findChild(QAction,"actionClear_all")
        self.connect(self.actionClear_all,SIGNAL('triggered (bool)'),self.ClearAll)
Exemplo n.º 33
0
    def __init__(self, argv):
        # init the widget
        QApplication.__init__(self, argv)

        # set up the state machine
        self._machine = QStateMachine()

        # Start with a top-level serial state
        self._exp_state = Serial(
            new_timeline=True)  #QState(QState.ExclusiveStates)
        self._current_parent = self._exp_state

        # Set as initial state of state machine
        self._machine.addState(self._exp_state)
        self._machine.setInitialState(self._exp_state)

        # set up timer
        self._last_time = now()
        self._new_time = now()
Exemplo n.º 34
0
    def __init__(self, *args):

        QApplication.__init__(self, *args)

        # initialize logging
        logging.basicConfig(filename='log.txt', level=logging.INFO,
                            filemode='w',format='%(asctime)s %(message)s')
        logging.info("Starting application.")

        # initialize user preferences
        preferences = Preferences()

        # initialize model
        market = GoxMarket(preferences)

        # initialize view
        self.view = View(preferences, market)

        self.connect(self, SIGNAL('lastWindowClosed()'), self.__quit)
Exemplo n.º 35
0
    def __init__(self, argv):



        QApplication.__init__(self, argv)

        # main window
        self.__mainWindow = QMainWindow()
        self.__ui1 = Ui_MainWindow()
        self.__glMain = object()
        self.__stl_model = StlModel()
        self.__stl_view = None

        # printing dialog
        self.__printingDialog = QDialog()
        self.__ui2 = Ui_PrintingDialog()

        # printing window
        self.__printingWindow = QMainWindow()
        self.__ui3 = Ui_PrintingWindow()
        self.__glStatus = object()

        # printer settings
        self.__printerSettings = QDialog()
        self.__ui4 = Ui_PrinterSettings()

        # slicing dialog
        # ToDo find something working as DropDown or get ComboBox working
        #self.__ui5 = ...

        # slicing window
        self.__glSlice = object()
        self.__slicingwindow = QMainWindow()
        self.__ui6 = Ui_SlicingWindow()
        self.__slicing_model = None
        self.__slicing_view = None
        self.__slices = None
        self.__slicing_index = 0

        self.__connection = None
        self.__config = ConfigurationModel()
        self.current_z = 0
Exemplo n.º 36
0
    def __init__(self, argv, key):
        QApplication.__init__(self, argv)

        self._key = key
        self._timeout = 1000

        socket = QLocalSocket(self)
        socket.connectToServer(self._key)
        if socket.waitForConnected(self._timeout):
            self._isRunning = True
            socket.abort()
            return
        socket.abort()

        self._isRunning = False
        self._server = QLocalServer(self)
        self._server.newConnection.connect(self.__onNewConnection)
        self._server.listen(self._key)

        self.aboutToQuit.connect(self.__onAboutToQuit)
Exemplo n.º 37
0
    def __init__(self, argv, key):
        QApplication.__init__(self, argv)

        self._key = key
        self._timeout = 1000

        socket = QLocalSocket(self)
        socket.connectToServer(self._key)
        if socket.waitForConnected(self._timeout):
            self._isRunning = True
            socket.abort()
            return
        socket.abort()

        self._isRunning = False
        self._server = QLocalServer(self)
        self._server.newConnection.connect(self.__onNewConnection)
        self._server.listen(self._key)

        self.aboutToQuit.connect(self.__onAboutToQuit)
Exemplo n.º 38
0
    def __init__(self, *args):

        QApplication.__init__(self, *args)

        # initialize logging
        logging.basicConfig(filename='log.txt',
                            level=logging.INFO,
                            filemode='w',
                            format='%(asctime)s %(message)s')
        logging.info("Starting application.")

        # initialize user preferences
        preferences = Preferences()

        # initialize model
        market = GoxMarket(preferences)

        # initialize view
        self.view = View(preferences, market)

        self.connect(self, SIGNAL('lastWindowClosed()'), self.__quit)
Exemplo n.º 39
0
 def __init__(self):
     QApplication.__init__(self, sys.argv)
     
     # Set the default background color to a darker grey.
     self.setPalette(QPalette(self.palette().button().color(), QColor(192, 192, 192)))
 
     self.window = MainWindow()
     self.window.show()
     self.window.start()
     self.window.setWindowTitle('OpenAnt')
     
     # Game timer, used in the gameloop FPS calculations.
     self.game_timer = QTime()
     self.game_timer.start()
     
     # Draw map, set view to ground.
     self.map = Map()
     Globals.view = self.map.generateMap()
     self.map.spawnAnts()
     
     # Start the main loop.
     self.gameLoop()
Exemplo n.º 40
0
    def __init__(self, *args):

        self.logfile = open('log.txt', 'w')

        QApplication.__init__(self, *args)

        # initialize model (gox)
        #goxapi.FORCE_PROTOCOL = 'socketio'
        self.config = goxapi.GoxConfig("goxtool.ini")
        self.secret = goxapi.Secret(self.config)
        self.gox = goxapi.Gox(self.secret, self.config)

        
        self.strategy_object = stoploss.Strategy(self.gox)
                
        # initialize view
        self.view = View(self.gox, self.secret, self.logfile)
        self.view.log('Starting application.')

        # start connection to MtGox
        self.gox.start()
        
        self.connect(self, SIGNAL('lastWindowClosed()'), self.__quit)
Exemplo n.º 41
0
    def __init__(self):
        QApplication.__init__(self, sys.argv)

        # Set the default background color to a darker grey.
        self.setPalette(
            QPalette(self.palette().button().color(), QColor(192, 192, 192)))

        self.window = MainWindow()
        self.window.show()
        self.window.start()
        self.window.setWindowTitle('OpenAnt')

        # Game timer, used in the gameloop FPS calculations.
        self.game_timer = QTime()
        self.game_timer.start()

        # Draw map, set view to ground.
        self.map = Map()
        Globals.view = self.map.generateMap()
        self.map.spawnAnts()

        # Start the main loop.
        self.gameLoop()
Exemplo n.º 42
0
    def __init__(self, *args):

        self.logfile = open('log.txt', 'w')

        QApplication.__init__(self, *args)

        # initialize model (gox)
        goxapi.FORCE_PROTOCOL = 'socketio'
        self.config = goxapi.GoxConfig("goxtool.ini")
        self.secret = goxapi.Secret(self.config)
        self.gox = goxapi.Gox(self.secret, self.config)

        # initialize view
        self.view = View(self.gox, self.secret, self.logfile)

        self.view.log('')
        self.view.log('Starting application.')
        self.view.log('')

        # start connection to MtGox
        self.gox.start()

        self.connect(self, SIGNAL('lastWindowClosed()'), self.__quit)
Exemplo n.º 43
0
    def __init__( self, argv, style ):
        QApplication.__init__( self, argv )

        # Sick! The QT doc recommends the following:
        # "To ensure that the application's style is set correctly, it is best
        # to call this function before the QApplication constructor, if
        # possible". However if I do it before QApplication.__init__() then
        # there is a crash! At least with some styles on Ubuntu 12.04 64 bit.
        # So I have to call the initialization after the __init__ call.
        QApplication.setStyle( style )

        self.mainWindow = None
        self.__lastFocus = None
        self.__beforeMenuBar = None

        # Sick! It seems that QT sends Activate/Deactivate signals every time
        # a dialog window is opened/closed. This happens very quickly (and
        # totally unexpected!). So the last focus widget must not be focused
        # unconditionally as the last focus may come from a dialog which has
        # already been destroyed. Without checking that a widget is still alive
        # (e.g. clicking 'Cancel' in a dialog box) leads to a core dump.

        QApplication.setWindowIcon( PixmapCache().getIcon( 'icon.png' ) )

        self.focusChanged.connect( self.__onFocusChanged )

        # Avoid having rectangular frames on the status bar and
        # some application wide style changes
        appCSS = GlobalData().skin.appCSS
        if appCSS != "":
            self.setStyleSheet( appCSS )

        # Install custom GC
        self.__gc = GarbageCollector( self )

        self.installEventFilter( self )
        return
Exemplo n.º 44
0
    def __init__(self, argv, style):
        QApplication.__init__(self, argv)

        # Sick! The QT doc recommends the following:
        # "To ensure that the application's style is set correctly, it is best
        # to call this function before the QApplication constructor, if
        # possible". However if I do it before QApplication.__init__() then
        # there is a crash! At least with some styles on Ubuntu 12.04 64 bit.
        # So I have to call the initialization after the __init__ call.
        QApplication.setStyle(style)

        self.mainWindow = None
        self.__lastFocus = None
        self.__beforeMenuBar = None

        # Sick! It seems that QT sends Activate/Deactivate signals every time
        # a dialog window is opened/closed. This happens very quickly (and
        # totally unexpected!). So the last focus widget must not be focused
        # unconditionally as the last focus may come from a dialog which has
        # already been destroyed. Without checking that a widget is still alive
        # (e.g. clicking 'Cancel' in a dialog box) leads to a core dump.

        QApplication.setWindowIcon(PixmapCache().getIcon('icon.png'))

        self.focusChanged.connect(self.__onFocusChanged)

        # Avoid having rectangular frames on the status bar and
        # some application wide style changes
        appCSS = GlobalData().skin.appCSS
        if appCSS != "":
            self.setStyleSheet(appCSS)

        # Install custom GC
        self.__gc = GarbageCollector(self)

        self.installEventFilter(self)
        return
Exemplo n.º 45
0
 def __init__(self, argv):
     QApplication.__init__(self, argv)
Exemplo n.º 46
0
 def __init__(self, argv):
   QApplication.__init__(self, argv)
Exemplo n.º 47
0
 def __init__(self, argv):
     QApplication.__init__(self, argv)
     self.progressBar = None
Exemplo n.º 48
0
 def __init__(self, *args):
     QApplication.__init__(self, *args)
Exemplo n.º 49
0
    def __init__(self, *args, **kwargs):
        QApplication.__init__(self, *args, **kwargs)

        self.object_creator_signal.connect(self.object_creator_slot)
        self.setWindowIcon(QIcon(load_pixmap('brickv-icon.png')))
Exemplo n.º 50
0
    def __init__(self):
        QApplication.__init__(self, sys.argv)
        self.setApplicationName(self.APPNAME)

        Application.__init__(self)
        self.cbmanager = QCallbacksManager(self.weboob, self)
Exemplo n.º 51
0
 def __init__(self):
     QApplication.__init__(self, sys.argv)
     self.mainWindowController = MainWindowController(self)
     self.exec_()
Exemplo n.º 52
0
    def __init__(self, *args, **kwargs):
        QApplication.__init__(self, *args, **kwargs)

        self.object_creator_signal.connect(self.object_creator_slot)
        self.setWindowIcon(QIcon(load_pixmap('brickv-icon.png')))
Exemplo n.º 53
0
    def __init__(self):
        QApplication.__init__(self, sys.argv)
        self.setApplicationName(self.APPNAME)

        Application.__init__(self)
        self.cbmanager = QCallbacksManager(self.weboob, self)
Exemplo n.º 54
0
 def __init__(self, argv):
     QApplication.__init__(self, argv)
     App._instance = self
Exemplo n.º 55
0
    def __init__(self):
        QApplication.__init__(self, sys.argv)
        self.setApplicationName(self.APPNAME)

        BaseApplication.__init__(self)
Exemplo n.º 56
0
 def __init__(self, *args):
     QApplication.__init__(self, *args)
     self.assertOnEvents = False