Beispiel #1
0
    def accept(self):
        app.settings.set("account", "username", self.lineEdit_loginUsername.text())
        app.settings.set("account", "password", self.lineEdit_loginPassword.text())
        app.settings.setbool("account", "autologin", self.checkBox_autoLogin.isChecked())
        doesAutoStartFileExists = self.doesAutoStartFileExists()
        if self.checkBox_autoStartFrontend.isChecked() and not doesAutoStartFileExists:
            # mkdir if autostart dir doesn't exist
            try:
                os.mkdir(os.path.dirname(constants.FRONTEND_AUTOSTART_FILE))
            except OSError:
                pass  # already exists
            os.symlink(constants.DESKTOP_FILE_LOCATION,
                       constants.FRONTEND_AUTOSTART_FILE)
        elif (not self.checkBox_autoStartFrontend.isChecked()) and doesAutoStartFileExists:
            os.remove(constants.FRONTEND_AUTOSTART_FILE)

        app.settings.setbool("frontend", "enabledeveloperstools",
                             self.checkBox_enableDevelopersTools.isChecked())
        app.settings.setbool("frontend", "allowflash",
                             self.checkBox_allowFlash.isChecked())
        app.settings.setbool("frontend", "minimizetosystray",
                             self.checkBox_minimizeToSystray.isChecked())

        # A possible Qt bug
        # https://bugreports.qt-project.org/browse/QTBUG-37695
        app.settings.setbool("frontend", "closetominimize",
                             self.checkBox_closeToMinimize.isChecked())
        app.settings.setbool("frontend", "popnotifications",
                             self.checkBox_popNotifications.isChecked())
        app.settings.setbool("frontend", "notifybysound",
                             self.checkBox_notifyBySound.isChecked())

        app.settings.setbool("frontend", "showmonitorwindow",
                             self.checkBox_showMonitorWindow.isChecked())
        app.settings.setint("frontend", "monitorfullspeed",
                            self.spinBox_monitorFullSpeed.value())
        app.settings.setbool("frontend", "watchclipboard",
                             self.checkBox_watchClipboard.isChecked())
        # app.settings.set("frontend", "watchpattern",
        #                         self.plaintext_watchPattern.toPlainText())

        if self.group_etmStartWhen.isEnabled():
            startEtmWhen = self.btngrp_etmStartWhen.id(self.btngrp_etmStartWhen.checkedButton())
            try:
                callXwaredInterface("setStartEtmWhen", startEtmWhen)
            except SocketDoesntExist:
                QMessageBox.warning(None, "Xware Desktop",
                                    "选项未能成功设置:{}。".format(self.group_etmStartWhen.title()),
                                    QMessageBox.Ok, QMessageBox.Ok)

        app.settings.save()

        app.mountsFaker.mounts = self.newMounts
        app.settings.applySettings.emit()
        super().accept()
Beispiel #2
0
    def __init__(self, parent):
        super().__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)

        self.setupUi(self)

        self.lineEdit_loginUsername.setText(app.settings.get("account", "username"))
        self.lineEdit_loginPassword.setText(app.settings.get("account", "password"))
        self.checkBox_autoLogin.setChecked(app.settings.getbool("account", "autologin"))
        self.checkBox_autoStartFrontend.setChecked(self.doesAutoStartFileExists())

        self.checkBox_enableDevelopersTools.setChecked(
            app.settings.getbool("frontend", "enabledeveloperstools"))
        self.checkBox_allowFlash.setChecked(app.settings.getbool("frontend", "allowflash"))
        self.checkBox_minimizeToSystray.setChecked(
            app.settings.getbool("frontend", "minimizetosystray"))
        self.checkBox_closeToMinimize.setChecked(
            app.settings.getbool("frontend", "closetominimize"))
        self.checkBox_popNotifications.setChecked(
            app.settings.getbool("frontend", "popnotifications"))
        self.checkBox_notifyBySound.setChecked(
            app.settings.getbool("frontend", "notifybysound"))
        self.checkBox_showMonitorWindow.setChecked(
            app.settings.getbool("frontend", "showmonitorwindow"))
        self.spinBox_monitorFullSpeed.setValue(
            app.settings.getint("frontend", "monitorfullspeed"))
        # clipboard related
        self.checkBox_watchClipboard.stateChanged.connect(self.slotWatchClipboardToggled)
        self.checkBox_watchClipboard.setChecked(app.settings.getbool("frontend", "watchclipboard"))
        self.slotWatchClipboardToggled(self.checkBox_watchClipboard.checkState())
        self.plaintext_watchPattern.setPlainText(app.settings.get("frontend", "watchpattern"))

        self.btngrp_etmStartWhen = QButtonGroup()
        self.btngrp_etmStartWhen.addButton(self.radio_backendStartWhen1, 1)
        self.btngrp_etmStartWhen.addButton(self.radio_backendStartWhen2, 2)
        self.btngrp_etmStartWhen.addButton(self.radio_backendStartWhen3, 3)

        try:
            startEtmWhen = callXwaredInterface("getStartEtmWhen")
            self.btngrp_etmStartWhen.button(startEtmWhen).setChecked(True)
        except SocketDoesntExist:
            self.group_etmStartWhen.setEnabled(False)

        self.btn_addMount.clicked.connect(self.slotAddMount)
        self.btn_removeMount.clicked.connect(self.slotRemoveMount)
        self.btn_refreshMount.clicked.connect(self.setupMounts)

        # Mounts
        self.setupMounts()

        # backend setting is a different thing!
        self.setupETM()
Beispiel #3
0
    def __init__(self, parent):
        super().__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)

        self.setupUi(self)

        self.lineEdit_loginUsername.setText(
            app.settings.get("account", "username"))
        self.lineEdit_loginPassword.setText(
            app.settings.get("account", "password"))
        self.checkBox_autoLogin.setChecked(
            app.settings.getbool("account", "autologin"))
        self.checkBox_autoStartFrontend.setChecked(
            self.doesAutoStartFileExists())

        self.checkBox_enableDevelopersTools.setChecked(
            app.settings.getbool("frontend", "enabledeveloperstools"))
        self.checkBox_allowFlash.setChecked(
            app.settings.getbool("frontend", "allowflash"))
        self.checkBox_minimizeToSystray.setChecked(
            app.settings.getbool("frontend", "minimizetosystray"))
        self.checkBox_closeToMinimize.setChecked(
            app.settings.getbool("frontend", "closetominimize"))
        self.checkBox_popNotifications.setChecked(
            app.settings.getbool("frontend", "popnotifications"))
        self.checkBox_notifyBySound.setChecked(
            app.settings.getbool("frontend", "notifybysound"))
        self.checkBox_showMonitorWindow.setChecked(
            app.settings.getbool("frontend", "showmonitorwindow"))
        self.spinBox_monitorFullSpeed.setValue(
            app.settings.getint("frontend", "monitorfullspeed"))
        # clipboard related
        self.checkBox_watchClipboard.stateChanged.connect(
            self.slotWatchClipboardToggled)
        self.checkBox_watchClipboard.setChecked(
            app.settings.getbool("frontend", "watchclipboard"))
        self.slotWatchClipboardToggled(
            self.checkBox_watchClipboard.checkState())
        self.plaintext_watchPattern.setPlainText(
            app.settings.get("frontend", "watchpattern"))

        self.btngrp_etmStartWhen = QButtonGroup()
        self.btngrp_etmStartWhen.addButton(self.radio_backendStartWhen1, 1)
        self.btngrp_etmStartWhen.addButton(self.radio_backendStartWhen2, 2)
        self.btngrp_etmStartWhen.addButton(self.radio_backendStartWhen3, 3)

        try:
            startEtmWhen = callXwaredInterface("getStartEtmWhen")
            self.btngrp_etmStartWhen.button(startEtmWhen).setChecked(True)
        except SocketDoesntExist:
            self.group_etmStartWhen.setEnabled(False)

        self.btn_addMount.clicked.connect(self.slotAddMount)
        self.btn_removeMount.clicked.connect(self.slotRemoveMount)
        self.btn_refreshMount.clicked.connect(self.setupMounts)

        # Mounts
        self.setupMounts()

        # backend setting is a different thing!
        self.setupETM()
Beispiel #4
0
    def accept(self):
        app.settings.set("account", "username",
                         self.lineEdit_loginUsername.text())
        app.settings.set("account", "password",
                         self.lineEdit_loginPassword.text())
        app.settings.setbool("account", "autologin",
                             self.checkBox_autoLogin.isChecked())
        doesAutoStartFileExists = self.doesAutoStartFileExists()
        if self.checkBox_autoStartFrontend.isChecked(
        ) and not doesAutoStartFileExists:
            # mkdir if autostart dir doesn't exist
            try:
                os.mkdir(os.path.dirname(constants.FRONTEND_AUTOSTART_FILE))
            except OSError:
                pass  # already exists
            os.symlink(constants.DESKTOP_FILE_LOCATION,
                       constants.FRONTEND_AUTOSTART_FILE)
        elif (not self.checkBox_autoStartFrontend.isChecked()
              ) and doesAutoStartFileExists:
            os.remove(constants.FRONTEND_AUTOSTART_FILE)

        app.settings.setbool("frontend", "enabledeveloperstools",
                             self.checkBox_enableDevelopersTools.isChecked())
        app.settings.setbool("frontend", "allowflash",
                             self.checkBox_allowFlash.isChecked())
        app.settings.setbool("frontend", "minimizetosystray",
                             self.checkBox_minimizeToSystray.isChecked())

        # A possible Qt bug
        # https://bugreports.qt-project.org/browse/QTBUG-37695
        app.settings.setbool("frontend", "closetominimize",
                             self.checkBox_closeToMinimize.isChecked())
        app.settings.setbool("frontend", "popnotifications",
                             self.checkBox_popNotifications.isChecked())
        app.settings.setbool("frontend", "notifybysound",
                             self.checkBox_notifyBySound.isChecked())

        app.settings.setbool("frontend", "showmonitorwindow",
                             self.checkBox_showMonitorWindow.isChecked())
        app.settings.setint("frontend", "monitorfullspeed",
                            self.spinBox_monitorFullSpeed.value())
        app.settings.setbool("frontend", "watchclipboard",
                             self.checkBox_watchClipboard.isChecked())
        # app.settings.set("frontend", "watchpattern",
        #                         self.plaintext_watchPattern.toPlainText())

        if self.group_etmStartWhen.isEnabled():
            startEtmWhen = self.btngrp_etmStartWhen.id(
                self.btngrp_etmStartWhen.checkedButton())
            try:
                callXwaredInterface("setStartEtmWhen", startEtmWhen)
            except SocketDoesntExist:
                QMessageBox.warning(
                    None, "Xware Desktop",
                    "选项未能成功设置:{}。".format(self.group_etmStartWhen.title()),
                    QMessageBox.Ok, QMessageBox.Ok)

        app.settings.save()

        app.mountsFaker.mounts = self.newMounts
        app.settings.applySettings.emit()
        super().accept()