예제 #1
0
    def refresh_info(self, refresh=0):
        """
        Reload the data file information and show them on the main dialog. The
        information here includes both metadata and hosts module info from the
        data file.

        :param refresh: A flag indicating whether the information on main
            dialog needs to be reloaded or not. The value could be `0` or `1`.

                =======  =============
                refresh  operation
                =======  =============
                0        Do NOT reload
                1        Reload
                =======  =============

        :type refresh: int
        """
        if refresh and RetrieveData.conn is not None:
            RetrieveData.clear()
        try:
            RetrieveData.unpack()
            RetrieveData.connect_db()
            self.set_func_list(refresh)
            self.refresh_func_list()
            self.set_info()
        except (BadZipfile, IOError, OSError):
            self.warning_incorrect_datafile()
예제 #2
0
    def refresh_info(self, refresh=0):
        """
        Reload the data file information and show them on the main dialog. The
        information here includes both metadata and hosts module info from the
        data file.

        :param refresh: A flag indicating whether the information on main
            dialog needs to be reloaded or not. The value could be `0` or `1`.

                =======  =============
                refresh  operation
                =======  =============
                0        Do NOT reload
                1        Reload
                =======  =============

        :type refresh: int
        """
        if refresh and RetrieveData.conn is not None:
            RetrieveData.clear()
        try:
            RetrieveData.unpack()
            RetrieveData.connect_db()
            self.set_func_list(refresh)
            self.refresh_func_list()
            self.set_info()
        except (BadZipfile, IOError, OSError):
            self.warning_incorrect_datafile()
예제 #3
0
 def __del__(self):
     """
     Clear up the temporary data file while TUI session is finished.
     """
     try:
         RetrieveData.clear()
     except:
         pass
예제 #4
0
 def __del__(self):
     """
     Reset the terminal and clear up the temporary data file while TUI
     session is finished.
     """
     super(HostsUtil, self).__del__()
     try:
         RetrieveData.clear()
     except:
         pass
예제 #5
0
 def __del__(self):
     """
     Reset the terminal and clear up the temporary data file while TUI
     session is finished.
     """
     super(HostsUtil, self).__del__()
     try:
         RetrieveData.clear()
     except:
         pass
예제 #6
0
    def close(self):
        """
        Close this program while the close signal is emitted.

        .. note:: This method is the slot responses to the close signal from
            an instance of the main dialog.
        """
        try:
            RetrieveData.clear()
        except:
            pass
        super(QDialogDaemon, self).close()
예제 #7
0
    def close(self):
        """
        Close this program while the close signal is emitted.

        .. note:: This method is the slot responses to the close signal from
            an instance of the main dialog.
        """
        try:
            RetrieveData.clear()
        except:
            pass
        super(QDialogDaemon, self).close()
예제 #8
0
 def start(cls,silent=0,mode='system'):
     cls.make_mode=mode  #Possible values are 'utf-8', 'ansi' and 'system'.
     cls.silent=silent
     cls.set_platform()
     cls.check_connection()
     cls.update = cls.check_update()
     if cls.check_version():
         cls.show_status("Update found!")
         cls.fetch_update()
         RetrieveData.unpack()
         RetrieveData.connect_db()
         cls.set_func_list()
         cls.select_all()
         cls.set_config_bytes()
         mk=MakeHosts(cls)
         mk.make()
         RetrieveData.clear()
         return 1
     else:
         cls.show_status("No update!")
         RetrieveData.clear()
         return 0