Example #1
0
    def __init__(self):
        super().__init__()
        # requirements checking
        self.ensureNonRoot()
        self.ensureOneInstance()

        profileBootstrap(constants.PROFILE_DIR)
        tryRemove(constants.XWARED_SOCKET[0])

        # initialize variables
        signal.signal(signal.SIGTERM, self.unload)
        signal.signal(signal.SIGINT, self.unload)
        self.settings = SettingsAccessorBase(constants.XWARED_CONFIG_FILE, XWARED_DEFAULTS_SETTINGS)
        self.toRunETM = self.settings.getbool("xwared", "startetm")
        self._resetEtmLongevities()

        # ipc listener
        self.listener = XwaredCommunicationListener(self)
        self.listener.start()

        # using pyinotify to monitor etm.cfg changes
        self.setupCfgWatcher()
Example #2
0
    def __init__(self, log_novomit):
        super().__init__()
        self._log_novomit = log_novomit
        self.etmPid = 0
        self.fdLock = None
        self.toRunETM = None
        self.etmStartedAt = None
        self.etmLongevities = None

        # Cfg watchers
        self.etmCfg = dict()
        self.watchManager = None
        self.cfgWatcher = None

        # requirements checking
        self.ensureNonRoot()
        profileBootstrap(constants.PROFILE_DIR)
        setupLogging()

        self.ensureOneInstance()

        tryRemove(constants.XWARED_SOCKET)

        # initialize variables
        signal.signal(signal.SIGTERM, self.unload)
        signal.signal(signal.SIGINT, self.unload)
        self.settings = SettingsAccessorBase(constants.XWARED_CONFIG_FILE,
                                             XWARED_DEFAULTS_SETTINGS)
        self.toRunETM = self.settings.getbool("xwared", "startetm")
        self.etmLogs = collections.deque(maxlen = 250)
        self._resetEtmLongevities()

        # ipc listener
        self.listener = ServerThread(self)
        self.listener.start()

        # using pyinotify to monitor etm.cfg changes
        self.setupCfgWatcher()
Example #3
0
    def __init__(self, log_novomit):
        super().__init__()
        self._log_novomit = log_novomit
        self.etmPid = 0
        self.fdLock = None
        self.toRunETM = None
        self.etmStartedAt = None
        self.etmLongevities = None

        # Cfg watchers
        self.etmCfg = dict()
        self.watchManager = None
        self.cfgWatcher = None

        # requirements checking
        self.ensureNonRoot()
        profileBootstrap(constants.PROFILE_DIR)
        setupLogging()

        self.ensureOneInstance()

        tryRemove(constants.XWARED_SOCKET)

        # initialize variables
        signal.signal(signal.SIGTERM, self.unload)
        signal.signal(signal.SIGINT, self.unload)
        self.settings = SettingsAccessorBase(constants.XWARED_CONFIG_FILE,
                                             XWARED_DEFAULTS_SETTINGS)
        self.toRunETM = self.settings.getbool("xwared", "startetm")
        self.etmLogs = collections.deque(maxlen=250)
        self._resetEtmLongevities()

        # ipc listener
        self.listener = ServerThread(self)
        self.listener.start()

        # using pyinotify to monitor etm.cfg changes
        self.setupCfgWatcher()
Example #4
0
    def __init__(self):
        super().__init__()
        # requirements checking
        self.ensureNonRoot()
        self.ensureOneInstance()

        profileBootstrap(constants.PROFILE_DIR)
        tryRemove(constants.XWARED_SOCKET[0])

        # initialize variables
        signal.signal(signal.SIGTERM, self.unload)
        signal.signal(signal.SIGINT, self.unload)
        self.settings = SettingsAccessorBase(constants.XWARED_CONFIG_FILE,
                                             XWARED_DEFAULTS_SETTINGS)
        self.toRunETM = self.settings.getbool("xwared", "startetm")
        self._resetEtmLongevities()

        # ipc listener
        self.listener = XwaredCommunicationListener(self)
        self.listener.start()

        # using pyinotify to monitor etm.cfg changes
        self.setupCfgWatcher()
Example #5
0
                    command=lambda: os.system("xdg-open '{}'".format(url)))
                self.viewThreadBtn.pack(side="bottom",
                                        fill="none",
                                        expand=True,
                                        pady=10)

                self.closeBtn = ttk.Button(self,
                                           text="我要卸载115网盘,关闭这个窗口",
                                           command=lambda: root.destroy())
                self.closeBtn.pack(side="bottom",
                                   fill="none",
                                   expand=True,
                                   pady=10)

        root = tk.Tk()
        root.title("Xware Desktop 提示")
        tkapp = QtIntegrityAlert(master=root)
        sys.exit(tkapp.mainloop())


app = None
if __name__ == "__main__":
    doQtIntegrityCheck()

    from shared.profile import profileBootstrap
    profileBootstrap(constants.PROFILE_DIR)
    app = XwareDesktop(sys.argv)
    sys.exit(app.exec())
else:
    app = QApplication.instance()
Example #6
0
          "    {msg}".format(strType = strType,
                             category = context.category,
                             function = context.function,
                             file = context.file,
                             line = context.line,
                             msg = msg),
          file = sys.stdout if msgType in (QtDebugMsg, QtWarningMsg) else sys.stderr)


app = None
if __name__ == "__main__":
    doQtIntegrityCheck()
    qInstallMessageHandler(QtMsgHandler)

    from shared.profile import profileBootstrap
    profileBootstrap(constants.PROFILE_DIR)
    app = XwareDesktop(sys.argv)

    def safeExec(app_):
        code = app_.exec()
        if __debug__:
            windows = app_.topLevelWindows()
            if windows:
                raise RuntimeError("Windows left: {}"
                                   .format(list(map(lambda win: win.objectName(),
                                                    windows))))
            widgets = app_.topLevelWidgets()
            if widgets:
                raise RuntimeError("Widgets left: {}"
                                   .format(list(map(lambda wid: wid.objectName(),
                                                    widgets))))