Esempio n. 1
0
 def __init__(self, masternode_list, imgDir):
     super().__init__()
     # Register the signal handlers
     signal.signal(signal.SIGTERM, service_shutdown)
     signal.signal(signal.SIGINT, service_shutdown)
     # Get version and title
     self.version = getSPMTVersion()
     self.title = 'SPMT - Secure PIVX Masternode Tool - v.%s-%s' % (self.version['number'], self.version['tag'])
     # Create the userdir if it doesn't exist
     if not os.path.exists(user_dir):
         os.makedirs(user_dir)
     # Initialize user interface
     self.initUI(masternode_list, imgDir)
Esempio n. 2
0
    def __init__(self, imgDir, app, start_args):
        # Create the userdir if it doesn't exist
        if not os.path.exists(user_dir):
            os.makedirs(user_dir)

        # Initialize Logs
        initLogs()
        super().__init__()
        self.app = app
        # Register the signal handlers
        signal.signal(signal.SIGTERM, service_shutdown)
        signal.signal(signal.SIGINT, service_shutdown)

        # Get version and title
        self.version = getSPMTVersion()
        self.title = 'SPMT - Secure PIVX Masternode Tool - v.%s-%s' % (
            self.version['number'], self.version['tag'])

        # Open database
        self.db = Database(self)
        self.db.open()

        # Clean v4 migration (read data from old files and delete them)
        clean_v4_migration(self)

        # Check for startup args (clear data)
        if start_args.clearAppData:
            settings = QSettings('PIVX', 'SecurePivxMasternodeTool')
            settings.clear()
        if start_args.clearRpcData:
            self.db.clearTable('CUSTOM_RPC_SERVERS')
        if start_args.clearMnData:
            self.db.clearTable('MASTERNODES')
        if start_args.clearTxCache:
            self.db.clearTable('RAWTXES')

        # Clear Rewards and Governance DB (in case of forced shutdown)
        self.db.clearTable('REWARDS')
        self.db.clearTable('PROPOSALS')
        self.db.clearTable('MY_VOTES')

        # Remove raw txes updated earlier than two months ago (if not already cleared)
        if not start_args.clearTxCache:
            self.db.clearRawTxes(time() - SECONDS_IN_2_MONTHS)

        # Read Masternode List
        masternode_list = self.db.getMasternodeList()
        # Read cached app data
        self.cache = readCacheSettings()
        # Initialize user interface
        self.initUI(masternode_list, imgDir)