示例#1
0
class DummyApp(QApplication):
    def __init__(self, *args):
        super().__init__(*args)

        from shared.config import SettingsAccessorBase
        from Settings import DEFAULT_SETTINGS
        self.settings = SettingsAccessorBase(constants.FRONTEND_CONFIG_FILE,
                                             DEFAULT_SETTINGS)

        from models import TaskModel, AdapterManager, ProxyModel
        from Schedule.model import SchedulerModel

        self.taskModel = TaskModel()
        self.proxyModel = ProxyModel()
        self.proxyModel.setSourceModel(self.taskModel)
        self.schedulerModel = SchedulerModel(self)
        self.schedulerModel.setSourceModel(self.taskModel)

        self.adapterManager = AdapterManager()
        for name, item in self.settings.itr_sections_with_prefix("adapter"):
            self.adapterManager.loadAdapter(item)

        self.qmlWin = QmlMain(None)
        self.qmlWin.show()
        self.aboutToQuit.connect(lambda: self.qmlWin.deleteLater())
示例#2
0
    def __init__(self, *args):
        super().__init__(*args)

        from shared.config import SettingsAccessorBase
        from Settings import DEFAULT_SETTINGS
        self.settings = SettingsAccessorBase(constants.FRONTEND_CONFIG_FILE,
                                             DEFAULT_SETTINGS)
        self.aboutToQuit.connect(lambda: self.settings.save())

        from models import TaskModel, AdapterManager, ProxyModel
        from Schedule.model import SchedulerModel

        self.taskModel = TaskModel()
        self.proxyModel = ProxyModel()
        self.proxyModel.setSourceModel(self.taskModel)
        self.schedulerModel = SchedulerModel(self)
        self.schedulerModel.setSourceModel(self.taskModel)

        self.adapterManager = AdapterManager(taskModel=self.taskModel)
        for name, item in self.settings.itr_sections_with_prefix("adapter"):
            self.adapterManager.loadAdapter(item)

        from Tasks.action import TaskCreationAgent
        self.taskCreationAgent = TaskCreationAgent(self)
        self.taskCreationAgent.available.connect(self.slotCreateTask)
        self.taskCreationDlg = None

        from Services import SessionService
        self.sessionService = SessionService(self)

        from Widgets.Main import QmlMain
        self.qmlWin = QmlMain(None)
        self.qmlWin.show()
        self.aboutToQuit.connect(lambda: self.qmlWin.deleteLater())
示例#3
0
def save(item):
    if item["ip"] != "":
        try:
            ProxyModel.create(**item)
            print("### Success save %s" % item["ip"])
        except IntegrityError as e:
            print("### Error: %s" % e)
示例#4
0
    def __init__(self, *args):
        super().__init__(*args)

        from shared.config import SettingsAccessorBase
        from Settings import DEFAULT_SETTINGS
        self.settings = SettingsAccessorBase(constants.FRONTEND_CONFIG_FILE,
                                             DEFAULT_SETTINGS)
        self.aboutToQuit.connect(lambda: self.settings.save())

        from models import TaskModel, AdapterManager, ProxyModel
        from Schedule.model import SchedulerModel

        self.taskModel = TaskModel()
        self.proxyModel = ProxyModel()
        self.proxyModel.setSourceModel(self.taskModel)
        self.schedulerModel = SchedulerModel(self)
        self.schedulerModel.setSourceModel(self.taskModel)

        self.adapterManager = AdapterManager(taskModel = self.taskModel)
        for name, item in self.settings.itr_sections_with_prefix("adapter"):
            self.adapterManager.loadAdapter(item)

        from Tasks.action import TaskCreationAgent
        self.taskCreationAgent = TaskCreationAgent(self)
        self.taskCreationAgent.available.connect(self.slotCreateTask)
        self.taskCreationDlg = None

        from Services import SessionService
        self.sessionService = SessionService(self)

        from Widgets.Main import QmlMain
        self.qmlWin = QmlMain(None)
        self.qmlWin.show()
        self.aboutToQuit.connect(lambda: self.qmlWin.deleteLater())
示例#5
0
def delete_proxy(uid):
    ret = ProxyModel.delete().where(ProxyModel.id == uid).execute()
    return jsonify({
        "status": 0,
        "msg": "ok",
        "rows": ret
    })
示例#6
0
def get_proxy():
    row = ProxyModel.select().order_by(-ProxyModel.score).first()
    item = dict()
    for k, v in row.__data__.items():
        if isinstance(v, datetime):
            v = v.strftime("%Y-%m-%d %H:%M:%S")
        item[k] = v

    return jsonify(item)
示例#7
0
    def __init__(self, *args):
        super().__init__(*args)

        from models import TaskModel, AdapterManager, ProxyModel
        from libxware import XwareAdapterThread

        self.taskModel = TaskModel()
        self.proxyModel = ProxyModel()
        self.proxyModel.setSourceModel(self.taskModel)

        self.adapterManager = AdapterManager()
        self.xwareAdapterThread = XwareAdapterThread({
            "host": "127.0.0.1",
            "port": 9000,
        })
        self.xwareAdapterThread.start()

        self.qmlWin = QmlMain(None)
        self.qmlWin.show()
示例#8
0
def check_all():
    rows = ProxyModel.select().order_by(ProxyModel.update_time).limit(10)
    for row in rows:
        proxy = "{}:{}".format(row.ip, row.port)
        status = get_status(proxy)
        print(row.id, proxy, status, row.source)

        if status == 200:
            score = int(row.score) + 1
        else:
            score = int(row.score) - 1

        ProxyModel.update(
            update_time=datetime.now(),
            score=score).where(ProxyModel.id == row.id).execute()

        if score < MIN_SCORE:
            ret = ProxyModel.delete().where(ProxyModel.id == row.id).execute()
            print("delete ret: %s" % ret)
示例#9
0
class DummyApp(QGuiApplication):
    def __init__(self, *args):
        super().__init__(*args)

        from models import TaskModel, AdapterManager, ProxyModel
        from libxware import XwareAdapterThread

        self.taskModel = TaskModel()
        self.proxyModel = ProxyModel()
        self.proxyModel.setSourceModel(self.taskModel)

        self.adapterManager = AdapterManager()
        self.xwareAdapterThread = XwareAdapterThread({
            "host": "127.0.0.1",
            "port": 9000,
        })
        self.xwareAdapterThread.start()

        self.qmlWin = QmlMain(None)
        self.qmlWin.show()
示例#10
0
def get_proxy_list(count):
    rows = ProxyModel.select().order_by(-ProxyModel.score).limit(count)

    lst = []
    for row in rows:
        item = dict()

        for k, v in row.__data__.items():
            if isinstance(v, datetime):
                v = v.strftime("%Y-%m-%d %H:%M:%S")
            item[k] = v
        lst.append(item)

    return jsonify(lst)
示例#11
0
    def __init__(self, *args):
        super().__init__(*args)
        logging.info("XWARE DESKTOP STARTS")
        self.setApplicationName("XwareDesktop")
        self.setApplicationVersion(__version__)
        os.chdir(os.path.dirname(os.path.abspath(__file__)))
        self.checkOneInstance()

        font = QFont()
        font.setPointSize(10)
        self.setFont(font)

        QIcon.setThemeName("")  # Compat for Ubuntu 14.04: A magical fix for #102

        from Settings import DEFAULT_SETTINGS
        from shared.config import SettingsAccessorBase
        self.settings = SettingsAccessorBase(constants.FRONTEND_CONFIG_FILE,
                                             DEFAULT_SETTINGS)
        self.aboutToQuit.connect(lambda: self.settings.save())

        from models import TaskModel, AdapterManager, ProxyModel

        self.taskModel = TaskModel()
        self.proxyModel = ProxyModel()
        self.proxyModel.setSourceModel(self.taskModel)

        self.adapterManager = AdapterManager(taskModel = self.taskModel)
        for name, item in self.settings.itr_sections_with_prefix("adapter"):
            self.adapterManager.loadAdapter(item)

        # components
        from Services import SessionService
        self.sessionService = SessionService(self)

        from Widgets.systray import Systray
        from Notify import Notifier
        from Schedule.model import SchedulerModel
        from Tasks.action import TaskCreationAgent

        self.systray = Systray(self)
        self.notifier = Notifier(taskModel = self.taskModel,
                                 frontendSettings = self.settings["frontend"],
                                 parent = self)
        self.schedulerModel = SchedulerModel(self)
        self.schedulerModel.setSourceModel(self.taskModel)
        self.taskCreationAgent = TaskCreationAgent(self)
        self.monitorWin = None
        self.applySettings.connect(self.slotCreateCloseMonitorWindow)

        # Legacy parts
        from legacy import main
        from legacy.frontendpy import FrontendPy
        self.mainWin = main.MainWindow(adapter = self.adapterManager[0],
                                       taskCreationAgent = self.taskCreationAgent,
                                       frontendSettings = self.settings["frontend"],
                                       app = self)
        self.mainWin.show()
        self.frontendpy = FrontendPy(taskCreationAgent = self.taskCreationAgent,
                                     legacySettings = self.settings["legacy"],
                                     adapterSettings = self.settings["adapter-legacy"],
                                     adapter = self.adapterManager[0],
                                     mainWin = self.mainWin,
                                     parent = self)
        self.sigMainWinLoaded.emit()

        self.applySettings.emit()

        upgradeGuide = None
        if self.settings.myGet("internal", "previousversion") == "0.8":
            # upgraded or fresh installed
            upgradeGuide = "https://github.com/Xinkai/XwareDesktop/wiki/使用说明"
        else:
            previousdate = self.settings.getfloat("internal", "previousdate")
            if previousdate == 0:  # upgrade from pre-0.12
                upgradeGuide = "https://github.com/Xinkai/XwareDesktop/wiki/升级到0.12"

        if upgradeGuide:
            from PyQt5.QtCore import QUrl
            from PyQt5.QtGui import QDesktopServices
            QDesktopServices.openUrl(QUrl(upgradeGuide))

        self.settings.set("internal", "previousversion", __version__)
        self.settings.setfloat("internal", "previousdate", DATE)
示例#12
0
class XwareDesktop(QApplication):
    sigMainWinLoaded = pyqtSignal()
    applySettings = pyqtSignal()
    toggleMinimized = pyqtSignal()

    def __init__(self, *args):
        super().__init__(*args)
        logging.info("XWARE DESKTOP STARTS")
        self.setApplicationName("XwareDesktop")
        self.setApplicationVersion(__version__)
        os.chdir(os.path.dirname(os.path.abspath(__file__)))
        self.checkOneInstance()

        font = QFont()
        font.setPointSize(10)
        self.setFont(font)

        QIcon.setThemeName("")  # Compat for Ubuntu 14.04: A magical fix for #102

        from Settings import DEFAULT_SETTINGS
        from shared.config import SettingsAccessorBase
        self.settings = SettingsAccessorBase(constants.FRONTEND_CONFIG_FILE,
                                             DEFAULT_SETTINGS)
        self.aboutToQuit.connect(lambda: self.settings.save())

        from models import TaskModel, AdapterManager, ProxyModel

        self.taskModel = TaskModel()
        self.proxyModel = ProxyModel()
        self.proxyModel.setSourceModel(self.taskModel)

        self.adapterManager = AdapterManager(taskModel = self.taskModel)
        for name, item in self.settings.itr_sections_with_prefix("adapter"):
            self.adapterManager.loadAdapter(item)

        # components
        from Services import SessionService
        self.sessionService = SessionService(self)

        from Widgets.systray import Systray
        from Notify import Notifier
        from Schedule.model import SchedulerModel
        from Tasks.action import TaskCreationAgent

        self.systray = Systray(self)
        self.notifier = Notifier(taskModel = self.taskModel,
                                 frontendSettings = self.settings["frontend"],
                                 parent = self)
        self.schedulerModel = SchedulerModel(self)
        self.schedulerModel.setSourceModel(self.taskModel)
        self.taskCreationAgent = TaskCreationAgent(self)
        self.monitorWin = None
        self.applySettings.connect(self.slotCreateCloseMonitorWindow)

        # Legacy parts
        from legacy import main
        from legacy.frontendpy import FrontendPy
        self.mainWin = main.MainWindow(adapter = self.adapterManager[0],
                                       taskCreationAgent = self.taskCreationAgent,
                                       frontendSettings = self.settings["frontend"],
                                       app = self)
        self.mainWin.show()
        self.frontendpy = FrontendPy(taskCreationAgent = self.taskCreationAgent,
                                     legacySettings = self.settings["legacy"],
                                     adapterSettings = self.settings["adapter-legacy"],
                                     adapter = self.adapterManager[0],
                                     mainWin = self.mainWin,
                                     parent = self)
        self.sigMainWinLoaded.emit()

        self.applySettings.emit()

        upgradeGuide = None
        if self.settings.myGet("internal", "previousversion") == "0.8":
            # upgraded or fresh installed
            upgradeGuide = "https://github.com/Xinkai/XwareDesktop/wiki/使用说明"
        else:
            previousdate = self.settings.getfloat("internal", "previousdate")
            if previousdate == 0:  # upgrade from pre-0.12
                upgradeGuide = "https://github.com/Xinkai/XwareDesktop/wiki/升级到0.12"

        if upgradeGuide:
            from PyQt5.QtCore import QUrl
            from PyQt5.QtGui import QDesktopServices
            QDesktopServices.openUrl(QUrl(upgradeGuide))

        self.settings.set("internal", "previousversion", __version__)
        self.settings.setfloat("internal", "previousdate", DATE)

    @staticmethod
    def checkOneInstance():
        fd = os.open(constants.FRONTEND_LOCK, os.O_RDWR | os.O_CREAT)

        alreadyRunning = False
        if os.name == "posix":
            import fcntl
            try:
                fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
            except BlockingIOError:
                alreadyRunning = True
        elif os.name == "nt":
            import msvcrt
            try:
                msvcrt.locking(fd, msvcrt.LK_NBLCK, 1)
            except PermissionError:
                alreadyRunning = True
        else:
            raise NotImplementedError("Xware Desktop doesn't support {}".format(os.name))

        if alreadyRunning:
            def showStartErrorAndExit():
                from PyQt5.QtWidgets import QMessageBox
                QMessageBox.warning(None, "Xware Desktop 启动失败",
                                    "Xware Desktop已经运行,或其没有正常退出。\n"
                                    "请检查:\n"
                                    "    1. 没有Xware Desktop正在运行\n"
                                    "    2. 上次运行的Xware Desktop没有残留"
                                    "(使用进程管理器查看名为python3或xware-desktop或launcher.py的进程)\n",
                                    QMessageBox.Ok, QMessageBox.Ok)
                sys.exit(-1)

            tasks = sys.argv[1:]
            if len(tasks) == 0:
                showStartErrorAndExit()
            else:
                from Tasks import CommandlineClient
                try:
                    CommandlineClient(tasks)
                except FileNotFoundError:
                    showStartErrorAndExit()
                except ConnectionRefusedError:
                    showStartErrorAndExit()
                sys.exit(0)

    @pyqtSlot()
    def slotCreateCloseMonitorWindow(self):
        logging.debug("slotCreateCloseMonitorWindow")
        show = self.settings.getbool("frontend", "showmonitorwindow")
        from Widgets import monitor
        if show:
            if self.monitorWin:
                pass  # already shown, do nothing
            else:
                self.monitorWin = monitor.MonitorWindow(None)
                self.monitorWin.show()
        else:
            if self.monitorWin:
                logging.debug("close monitorwin")
                self.monitorWin.close()
                del self.monitorWin
                self.monitorWin = None
            else:
                pass  # not shown, do nothing

    @property
    def autoStart(self):
        return os.path.lexists(constants.DESKTOP_AUTOSTART_FILE)

    @autoStart.setter
    def autoStart(self, on):
        if on:
            # mkdir if autostart dir doesn't exist
            misc.tryMkdir(os.path.dirname(constants.DESKTOP_AUTOSTART_FILE))

            misc.trySymlink(constants.DESKTOP_FILE,
                            constants.DESKTOP_AUTOSTART_FILE)
        else:
            misc.tryRemove(constants.DESKTOP_AUTOSTART_FILE)
示例#13
0
    def __init__(self, *args):
        super().__init__(*args)
        logging.info("XWARE DESKTOP STARTS")
        self.setApplicationName("XwareDesktop")
        self.setApplicationVersion(__version__)
        os.chdir(os.path.dirname(os.path.abspath(__file__)))
        self.checkOneInstance()

        font = QFont()
        font.setPointSize(10)
        self.setFont(font)

        QIcon.setThemeName(
            "")  # Compat for Ubuntu 14.04: A magical fix for #102

        from Settings import DEFAULT_SETTINGS
        from shared.config import SettingsAccessorBase
        self.settings = SettingsAccessorBase(constants.FRONTEND_CONFIG_FILE,
                                             DEFAULT_SETTINGS)
        self.aboutToQuit.connect(lambda: self.settings.save())

        from models import TaskModel, AdapterManager, ProxyModel

        self.taskModel = TaskModel()
        self.proxyModel = ProxyModel()
        self.proxyModel.setSourceModel(self.taskModel)

        self.adapterManager = AdapterManager(taskModel=self.taskModel)
        for name, item in self.settings.itr_sections_with_prefix("adapter"):
            self.adapterManager.loadAdapter(item)

        # components
        from Services import SessionService
        self.sessionService = SessionService(self)

        from Widgets.systray import Systray
        from Notify import Notifier
        from Schedule.model import SchedulerModel
        from Tasks.action import TaskCreationAgent

        self.systray = Systray(self)
        self.notifier = Notifier(taskModel=self.taskModel,
                                 frontendSettings=self.settings["frontend"],
                                 parent=self)
        self.schedulerModel = SchedulerModel(self)
        self.schedulerModel.setSourceModel(self.taskModel)
        self.taskCreationAgent = TaskCreationAgent(self)
        self.monitorWin = None
        self.applySettings.connect(self.slotCreateCloseMonitorWindow)

        # Legacy parts
        from legacy import main
        from legacy.frontendpy import FrontendPy
        self.mainWin = main.MainWindow(
            adapter=self.adapterManager[0],
            taskCreationAgent=self.taskCreationAgent,
            frontendSettings=self.settings["frontend"],
            app=self)
        self.mainWin.show()
        self.frontendpy = FrontendPy(
            taskCreationAgent=self.taskCreationAgent,
            legacySettings=self.settings["legacy"],
            adapterSettings=self.settings["adapter-legacy"],
            adapter=self.adapterManager[0],
            mainWin=self.mainWin,
            parent=self)
        self.sigMainWinLoaded.emit()

        self.applySettings.emit()

        upgradeGuide = None
        if self.settings.myGet("internal", "previousversion") == "0.8":
            # upgraded or fresh installed
            upgradeGuide = "https://github.com/Xinkai/XwareDesktop/wiki/使用说明"
        else:
            previousdate = self.settings.getfloat("internal", "previousdate")
            if previousdate == 0:  # upgrade from pre-0.12
                upgradeGuide = "https://github.com/Xinkai/XwareDesktop/wiki/升级到0.12"

        if upgradeGuide:
            from PyQt5.QtCore import QUrl
            from PyQt5.QtGui import QDesktopServices
            QDesktopServices.openUrl(QUrl(upgradeGuide))

        self.settings.set("internal", "previousversion", __version__)
        self.settings.setfloat("internal", "previousdate", DATE)
示例#14
0
class XwareDesktop(QApplication):
    sigMainWinLoaded = pyqtSignal()
    applySettings = pyqtSignal()
    toggleMinimized = pyqtSignal()

    def __init__(self, *args):
        super().__init__(*args)
        logging.info("XWARE DESKTOP STARTS")
        self.setApplicationName("XwareDesktop")
        self.setApplicationVersion(__version__)
        os.chdir(os.path.dirname(os.path.abspath(__file__)))
        self.checkOneInstance()

        font = QFont()
        font.setPointSize(10)
        self.setFont(font)

        QIcon.setThemeName(
            "")  # Compat for Ubuntu 14.04: A magical fix for #102

        from Settings import DEFAULT_SETTINGS
        from shared.config import SettingsAccessorBase
        self.settings = SettingsAccessorBase(constants.FRONTEND_CONFIG_FILE,
                                             DEFAULT_SETTINGS)
        self.aboutToQuit.connect(lambda: self.settings.save())

        from models import TaskModel, AdapterManager, ProxyModel

        self.taskModel = TaskModel()
        self.proxyModel = ProxyModel()
        self.proxyModel.setSourceModel(self.taskModel)

        self.adapterManager = AdapterManager(taskModel=self.taskModel)
        for name, item in self.settings.itr_sections_with_prefix("adapter"):
            self.adapterManager.loadAdapter(item)

        # components
        from Services import SessionService
        self.sessionService = SessionService(self)

        from Widgets.systray import Systray
        from Notify import Notifier
        from Schedule.model import SchedulerModel
        from Tasks.action import TaskCreationAgent

        self.systray = Systray(self)
        self.notifier = Notifier(taskModel=self.taskModel,
                                 frontendSettings=self.settings["frontend"],
                                 parent=self)
        self.schedulerModel = SchedulerModel(self)
        self.schedulerModel.setSourceModel(self.taskModel)
        self.taskCreationAgent = TaskCreationAgent(self)
        self.monitorWin = None
        self.applySettings.connect(self.slotCreateCloseMonitorWindow)

        # Legacy parts
        from legacy import main
        from legacy.frontendpy import FrontendPy
        self.mainWin = main.MainWindow(
            adapter=self.adapterManager[0],
            taskCreationAgent=self.taskCreationAgent,
            frontendSettings=self.settings["frontend"],
            app=self)
        self.mainWin.show()
        self.frontendpy = FrontendPy(
            taskCreationAgent=self.taskCreationAgent,
            legacySettings=self.settings["legacy"],
            adapterSettings=self.settings["adapter-legacy"],
            adapter=self.adapterManager[0],
            mainWin=self.mainWin,
            parent=self)
        self.sigMainWinLoaded.emit()

        self.applySettings.emit()

        upgradeGuide = None
        if self.settings.myGet("internal", "previousversion") == "0.8":
            # upgraded or fresh installed
            upgradeGuide = "https://github.com/Xinkai/XwareDesktop/wiki/使用说明"
        else:
            previousdate = self.settings.getfloat("internal", "previousdate")
            if previousdate == 0:  # upgrade from pre-0.12
                upgradeGuide = "https://github.com/Xinkai/XwareDesktop/wiki/升级到0.12"

        if upgradeGuide:
            from PyQt5.QtCore import QUrl
            from PyQt5.QtGui import QDesktopServices
            QDesktopServices.openUrl(QUrl(upgradeGuide))

        self.settings.set("internal", "previousversion", __version__)
        self.settings.setfloat("internal", "previousdate", DATE)

    @staticmethod
    def checkOneInstance():
        fd = os.open(constants.FRONTEND_LOCK, os.O_RDWR | os.O_CREAT)

        alreadyRunning = False
        if os.name == "posix":
            import fcntl
            try:
                fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
            except BlockingIOError:
                alreadyRunning = True
        elif os.name == "nt":
            import msvcrt
            try:
                msvcrt.locking(fd, msvcrt.LK_NBLCK, 1)
            except PermissionError:
                alreadyRunning = True
        else:
            raise NotImplementedError(
                "Xware Desktop doesn't support {}".format(os.name))

        if alreadyRunning:

            def showStartErrorAndExit():
                from PyQt5.QtWidgets import QMessageBox
                QMessageBox.warning(
                    None, "Xware Desktop 启动失败", "Xware Desktop已经运行,或其没有正常退出。\n"
                    "请检查:\n"
                    "    1. 没有Xware Desktop正在运行\n"
                    "    2. 上次运行的Xware Desktop没有残留"
                    "(使用进程管理器查看名为python3或xware-desktop或launcher.py的进程)\n",
                    QMessageBox.Ok, QMessageBox.Ok)
                sys.exit(-1)

            tasks = sys.argv[1:]
            if len(tasks) == 0:
                showStartErrorAndExit()
            else:
                from Tasks import CommandlineClient
                try:
                    CommandlineClient(tasks)
                except FileNotFoundError:
                    showStartErrorAndExit()
                except ConnectionRefusedError:
                    showStartErrorAndExit()
                sys.exit(0)

    @pyqtSlot()
    def slotCreateCloseMonitorWindow(self):
        logging.debug("slotCreateCloseMonitorWindow")
        show = self.settings.getbool("frontend", "showmonitorwindow")
        from Widgets import monitor
        if show:
            if self.monitorWin:
                pass  # already shown, do nothing
            else:
                self.monitorWin = monitor.MonitorWindow(None)
                self.monitorWin.show()
        else:
            if self.monitorWin:
                logging.debug("close monitorwin")
                self.monitorWin.close()
                del self.monitorWin
                self.monitorWin = None
            else:
                pass  # not shown, do nothing

    @property
    def autoStart(self):
        return os.path.lexists(constants.DESKTOP_AUTOSTART_FILE)

    @autoStart.setter
    def autoStart(self, on):
        if on:
            # mkdir if autostart dir doesn't exist
            misc.tryMkdir(os.path.dirname(constants.DESKTOP_AUTOSTART_FILE))

            misc.trySymlink(constants.DESKTOP_FILE,
                            constants.DESKTOP_AUTOSTART_FILE)
        else:
            misc.tryRemove(constants.DESKTOP_AUTOSTART_FILE)