コード例 #1
0
def main():
    ampChildPath = 'InputOutput.interprocessChildProt.NetworkingProcessProtocol'
    from twisted.internet import stdio
    from twisted.python import reflect
    protInstance = reflect.namedAny(ampChildPath)(
        reactor)  # Invoke what you found.
    Demeter.committer.receiveInterprocessProtocolInstance(protInstance)
    d = Demeter.checkUPNPStatus(2000)

    def maybeCommit():
        print(
            'Attempting to commit. Commit In Progress flag is %s, last commit was at %s'
            %
            (Demeter.committer.commitInProgress, Demeter.committer.lastCommit))
        if Demeter.committer.commitInProgress is False:
            print('Commit loop decided to commit. #COMMITSTART')
            Demeter.committer.commit()
        else:
            print(
                'Commit loop decided to NOT commit, variables are: commitInProgress = %s, lastCommit = %s '
                '#COMMITDECLINE' % (Demeter.committer.commitInProgress,
                                    Demeter.committer.lastCommit))

    persephone = LoopingCall(maybeCommit)
    persephone.start(30)  # this should be 60 under normal circumstances.
    marduk = LoopingCall(eventLoop.marduk,
                         aetherProtocol.aetherProtocolFactoryInstance,
                         Demeter.committer)
    marduk.start(30)  # Should this be 5 minutes? (300)
    listenerEndpoint = SSL4ServerEndpoint(
        reactor, globals.userProfile.get('machineDetails', 'listeningPort'),
        globals.AetherContextFactory())
    listenerEndpoint.listen(aetherProtocol.aetherProtocolFactoryInstance)

    if FROZEN:
        if PLATFORM == 'WIN':
            stdio.StandardIO(protInstance)
        elif PLATFORM == 'OSX':
            stdio.StandardIO(protInstance, 7, 8)
        elif PLATFORM == 'LNX':
            stdio.StandardIO(protInstance, 7, 8)
    else:
        if PLATFORM == 'WIN':
            stdio.StandardIO(protInstance)
        elif PLATFORM == 'OSX':
            stdio.StandardIO(protInstance, 7, 8)
        elif PLATFORM == 'LNX':
            stdio.StandardIO(protInstance, 7, 8)

    reactor.run()
コード例 #2
0
def main():
    ampChildPath = 'InputOutput.interprocessChildProt.NetworkingProcessProtocol'
    from twisted.internet import stdio
    from twisted.python import reflect
    protInstance = reflect.namedAny(ampChildPath)(reactor)  # Invoke what you found.
    Demeter.committer.receiveInterprocessProtocolInstance(protInstance)
    d = Demeter.checkUPNPStatus(2000)

    def maybeCommit():
        print('Attempting to commit. Commit In Progress flag is %s, last commit was at %s' %
              (Demeter.committer.commitInProgress, Demeter.committer.lastCommit))
        if Demeter.committer.commitInProgress is False:
            print('Commit loop decided to commit. #COMMITSTART')
            Demeter.committer.commit()
        else:
            print('Commit loop decided to NOT commit, variables are: commitInProgress = %s, lastCommit = %s '
                  '#COMMITDECLINE' % (Demeter.committer.commitInProgress, Demeter.committer.lastCommit))

    persephone = LoopingCall(maybeCommit)
    persephone.start(30)  # this should be 60 under normal circumstances.
    marduk = LoopingCall(eventLoop.marduk, aetherProtocol.aetherProtocolFactoryInstance, Demeter.committer)
    marduk.start(30)  # Should this be 5 minutes? (300)
    listenerEndpoint = SSL4ServerEndpoint(reactor, globals.userProfile.get('machineDetails', 'listeningPort'), globals.AetherContextFactory())
    listenerEndpoint.listen(aetherProtocol.aetherProtocolFactoryInstance)

    if FROZEN:
        if PLATFORM == 'WIN':
            stdio.StandardIO(protInstance)
        elif PLATFORM == 'OSX':
            stdio.StandardIO(protInstance, 7, 8)
        elif PLATFORM == 'LNX':
            stdio.StandardIO(protInstance, 7, 8)
    else:
        if PLATFORM == 'WIN':
            stdio.StandardIO(protInstance)
        elif PLATFORM == 'OSX':
            stdio.StandardIO(protInstance, 7, 8)
        elif PLATFORM == 'LNX':
            stdio.StandardIO(protInstance, 7, 8)

    reactor.run()
コード例 #3
0
ファイル: main.py プロジェクト: payingattention/aether-public
def main():

    from InputOutput import interprocessChildProt
    from ampoule import pool
    from InputOutput import interprocessParentProt
    from ampoule import main as ampouleMain

    procStarter = ampouleMain.ProcessStarter(
        bootstrap=interprocessChildProt.childBootstrap)
    global pp
    pp = pool.ProcessPool(interprocessChildProt.GUIProcessProtocol,
                          ampParent=interprocessParentProt.MainProcessProtocol,
                          starter=procStarter,
                          recycleAfter=0,
                          min=1,
                          max=1)

    pp.start()
    pp.ampParent.processPool = pp  # Self referential much?

    Demeter.committer.receiveInterprocessProtocolInstance(pp)

    def checkForUpdates():
        # One catch, any result available out of this will only be visible after next boot of the app.
        d = getPage('http://192.30.33.227')

        def processReceivedVersion(reply):

            if int(reply[:3]) > globals.appVersion:
                globals.updateAvailable = True
                print(
                    'There is an update available, local version is %d and gathered version is %s.'
                    % (globals.appVersion, reply))
            else:
                globals.updateAvailable = False
                print('There is no update available')
            globals.setUpdateAvailable(globals.updateAvailable)

        d.addCallback(processReceivedVersion)

    checkForUpdates()

    d = Demeter.checkUPNPStatus(2000)

    def maybeCommit():
        thirtySecondsAgo = datetime.datetime.utcnow() - datetime.timedelta(
            seconds=10)  # FIXME make it 30 in live.
        if Demeter.committer.lastCommit < thirtySecondsAgo and Demeter.committer.commitInProgress is False:
            print('Commit loop decided to commit.')
            Demeter.committer.commit()

    persephone = LoopingCall(maybeCommit)
    persephone.start(10)  # this should be 60 under normal circumstances.
    marduk = LoopingCall(eventLoop.marduk,
                         aetherProtocol.aetherProtocolFactoryInstance,
                         Demeter.committer)
    marduk.start(60)
    #FIXME#marduk.start(60) # 5 minutes normally, which is 300

    listenerEndpoint = SSL4ServerEndpoint(reactor, aetherListeningPort,
                                          globals.AetherContextFactory())
    listenerEndpoint.listen(aetherProtocol.aetherProtocolFactoryInstance)

    # def checksan():
    #     d = pp.callRemote(interprocessChildProt.checkSanity)
    #     d.addCallback(print)
    # def bootstuff():
    #     d = pp.callRemote(interprocessChildProt.bootGUI)
    #     d.addCallback(print)
    # reactor.callLater(2, bootstuff)
    # reactor.callLater(20, checksan)
    #reactor.callLater(5, aetherProtocol.connectWithIP,'151.236.11.192', 39994) #192 ends
    reactor.run()
コード例 #4
0
ファイル: main.py プロジェクト: ailurocrat/aether-public
 def upnpSanityCheck(returnVal):
     if returnVal is False:
         print(
             'Oops, the network could not map in 10 seconds. Trying a minute.'
         )
         Demeter.checkUPNPStatus(60000)
コード例 #5
0
ファイル: main.py プロジェクト: ailurocrat/aether-public
def main():
    from time import sleep
    charon = Charon()
    global view
    view = aetherMainWindow(reactor)
    view.page().mainFrame().addToJavaScriptWindowObject("Charon", charon)
    view.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)

    def checkForUpdates():
        # One catch, any result available out of this will only be visible after next boot of the app.
        d = getPage('http://192.30.33.227')

        def processReceivedVersion(reply):

            if int(reply[:3]) > globals.appVersion:
                globals.updateAvailable = True
                print(
                    'There is an update available, local version is %d and gathered version is %s.'
                    % (globals.appVersion, reply))
            else:
                globals.updateAvailable = False
                print('There is no update available')
            globals.setUpdateAvailable(globals.updateAvailable)

        d.addCallback(processReceivedVersion)

    checkForUpdates()

    def iconClicked(self, reason):
        pass

    trayIcon = SystemTrayIcon(iconClicked, view)
    trayIcon.show()

    d = Demeter.checkUPNPStatus(10000)

    def upnpSanityCheck(returnVal):
        if returnVal is False:
            print(
                'Oops, the network could not map in 10 seconds. Trying a minute.'
            )
            Demeter.checkUPNPStatus(60000)
            # If that also fails, we're in hostile territory.

    d.addCallback(upnpSanityCheck)

    persephone = LoopingCall(eventLoop.persephone)
    persephone.start(10)  # this should be 60 under normal circumstances.
    marduk = LoopingCall(eventLoop.marduk)
    marduk.start(60)  # 5 minutes normally, which is 300

    logSender = LoopingCall(eventLoop.sendLogs, reactor)
    logSender.start(86400)  # send it every day.

    #enableWebkitInspector = True
    if enableWebkitInspector is True:
        from PyQt5.QtWebKit import QWebSettings
        QWebSettings.globalSettings().setAttribute(
            QWebSettings.DeveloperExtrasEnabled, True)
        inspect = QWebInspector()
        inspect.resize(1450, 300)
        inspect.move(0, 0)
        inspect.setPage(view.page())
        view.setContextMenuPolicy(Qt.DefaultContextMenu)
        inspect.show()

    listenerEndpoint = SSL4ServerEndpoint(reactor, aetherListeningPort,
                                          globals.AetherContextFactory())
    listenerEndpoint.listen(aetherProtocol.AetherProtocolFactory())

    splash.finish(view)
    if not globals.appStartedAtBoot:
        view.show()
        toggleVisibilityMenuItem.setText('Hide Aether')
    reactor.run()
コード例 #6
0
ファイル: main.py プロジェクト: Ryman/aether-public
 def upnpSanityCheck(returnVal):
     if returnVal is False:
         print('Oops, the network could not map in 10 seconds. Trying a minute.')
         Demeter.checkUPNPStatus(60000)
コード例 #7
0
ファイル: main.py プロジェクト: Ryman/aether-public
def main():
    from time import sleep
    charon = Charon()
    global view
    view = aetherMainWindow(reactor)
    view.page().mainFrame().addToJavaScriptWindowObject("Charon", charon)
    view.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)

    def checkForUpdates():
        # One catch, any result available out of this will only be visible after next boot of the app.
        d = getPage('http://192.30.33.227')
        def processReceivedVersion(reply):

            if int(reply[:3]) > globals.appVersion:
                globals.updateAvailable = True
                print('There is an update available, local version is %d and gathered version is %s.' %(globals.appVersion, reply))
            else:
                globals.updateAvailable = False
                print('There is no update available')
            globals.setUpdateAvailable(globals.updateAvailable)
        d.addCallback(processReceivedVersion)

    checkForUpdates()


    def iconClicked(self, reason):
        pass

    trayIcon = SystemTrayIcon(iconClicked, view)
    trayIcon.show()

    d = Demeter.checkUPNPStatus(10000)
    def upnpSanityCheck(returnVal):
        if returnVal is False:
            print('Oops, the network could not map in 10 seconds. Trying a minute.')
            Demeter.checkUPNPStatus(60000)
            # If that also fails, we're in hostile territory.
    d.addCallback(upnpSanityCheck)

    persephone = LoopingCall(eventLoop.persephone)
    persephone.start(10) # this should be 60 under normal circumstances.
    marduk = LoopingCall(eventLoop.marduk)
    marduk.start(60) # 5 minutes normally, which is 300

    logSender = LoopingCall(eventLoop.sendLogs, reactor)
    logSender.start(86400) # send it every day.

    #enableWebkitInspector = True
    if enableWebkitInspector is True:
        from PyQt5.QtWebKit import QWebSettings
        QWebSettings.globalSettings().setAttribute(QWebSettings.DeveloperExtrasEnabled, True)
        inspect = QWebInspector()
        inspect.resize(1450, 300)
        inspect.move(0,0)
        inspect.setPage(view.page())
        view.setContextMenuPolicy(Qt.DefaultContextMenu)
        inspect.show()

    listenerEndpoint = SSL4ServerEndpoint(reactor, aetherListeningPort, globals.AetherContextFactory())
    listenerEndpoint.listen(aetherProtocol.AetherProtocolFactory())

    splash.finish(view)
    if not globals.appStartedAtBoot:
        view.show()
        toggleVisibilityMenuItem.setText('Hide Aether')
    reactor.run()
コード例 #8
0
ファイル: main.py プロジェクト: gordol/aether-public
def main():

    from InputOutput import interprocessChildProt
    from ampoule import pool
    from  InputOutput import interprocessParentProt
    from ampoule import main as ampouleMain

    procStarter = ampouleMain.ProcessStarter(bootstrap=interprocessChildProt.childBootstrap)
    global pp
    pp = pool.ProcessPool(interprocessChildProt.GUIProcessProtocol,
                          ampParent=interprocessParentProt.MainProcessProtocol,
                          starter=procStarter,
                          recycleAfter=0,
                          min=1, max=1)

    pp.start()
    pp.ampParent.processPool = pp # Self referential much?

    Demeter.committer.receiveInterprocessProtocolInstance(pp)

    def checkForUpdates():
        # One catch, any result available out of this will only be visible after next boot of the app.
        d = getPage('http://192.30.33.227')
        def processReceivedVersion(reply):

            if int(reply[:3]) > globals.appVersion:
                globals.updateAvailable = True
                print('There is an update available, local version is %d and gathered version is %s.' %(globals.appVersion, reply))
            else:
                globals.updateAvailable = False
                print('There is no update available')
            globals.setUpdateAvailable(globals.updateAvailable)
        d.addCallback(processReceivedVersion)

    checkForUpdates()

    d = Demeter.checkUPNPStatus(2000)

    def maybeCommit():
        thirtySecondsAgo = datetime.datetime.utcnow() - datetime.timedelta(seconds=10) # FIXME make it 30 in live.
        if Demeter.committer.lastCommit < thirtySecondsAgo and Demeter.committer.commitInProgress is False:
            print('Commit loop decided to commit.')
            Demeter.committer.commit()

    persephone = LoopingCall(maybeCommit)
    persephone.start(10) # this should be 60 under normal circumstances.
    marduk = LoopingCall(eventLoop.marduk, aetherProtocol.aetherProtocolFactoryInstance, Demeter.committer)
    marduk.start(60)
    #FIXME#marduk.start(60) # 5 minutes normally, which is 300

    listenerEndpoint = SSL4ServerEndpoint(reactor, aetherListeningPort, globals.AetherContextFactory())
    listenerEndpoint.listen(aetherProtocol.aetherProtocolFactoryInstance)


    # def checksan():
    #     d = pp.callRemote(interprocessChildProt.checkSanity)
    #     d.addCallback(print)
    # def bootstuff():
    #     d = pp.callRemote(interprocessChildProt.bootGUI)
    #     d.addCallback(print)
    # reactor.callLater(2, bootstuff)
    # reactor.callLater(20, checksan)
    #reactor.callLater(5, aetherProtocol.connectWithIP,'151.236.11.192', 39994) #192 ends
    reactor.run()