Beispiel #1
0
class TaskThread(QThread):

    newTask = pyqtSignal(QVariant, arguments=['result'])

    def __init__(self):
        QObject.__init__(self)
        self.filters = []
        self._paused = False
        self._localAPI = TaskhiveAPI()

    @pyqtSlot()
    def pause(self):
        self._paused = True

    @pyqtSlot()
    def resume(self):
        self._paused = False

    @pyqtSlot()
    def run(self):
        self._localAPI.create_bitmessage_api()
        while not self._paused:
            result = self._localAPI.getPostings()
            print(result)
            connections, _, _, _ = self._localAPI.client_connections()
            result['connections'] = connections
            self.newTask.emit(result)
            print(connections)
            time.sleep(5)

    def handle_filters(self):
        return None
Beispiel #2
0
class CreateProfile(QThread):
    def __init__(self):
        QObject.__init__(self)
        self._localAPI = TaskhiveAPI()

    @pyqtSlot(QVariant)
    def create(self, profile_DATA):
        profile_JSON = profile_DATA.toVariant()
        self._localAPI.createProfile(profile_JSON)
Beispiel #3
0
class SendMessageThread(QThread):
    def __init__(self, task_JSON):
        QObject.__init__(self)
        self._localAPI = TaskhiveAPI()
        self._JSON = task_JSON

    @pyqtSlot()
    def run(self):
        self._localAPI.create_bitmessage_api()
        task_JSON = self._JSON.toVariant()
        self._localAPI.send_privMessage(task_JSON)
Beispiel #4
0
class TaskProfile(QThread):
    def __init__(self):
        QObject.__init__(self)
        self._localAPI = TaskhiveAPI()

    @pyqtSlot(result=QVariant)
    def verifyProfile(self):
        return self._localAPI.verifyProfile()
Beispiel #5
0
class MessageThread(QThread):

    msg = pyqtSignal(QVariant, arguments=['msg'])

    def __init__(self, task_id, from_add=None):
        QObject.__init__(self)
        self._localAPI = TaskhiveAPI()
        self.task_id = task_id
        self.from_add = from_add

    @pyqtSlot()
    def run(self):
        self._localAPI.create_bitmessage_api()
        msg_p = self._localAPI.getMessageThread(self.task_id,
                                                from_add=self.from_add)
        print(msg_p)
        self.msg.emit(msg_p)
Beispiel #6
0
class TaskSendPost(QThread):

    taskStatus = pyqtSignal(QVariant, arguments=['status'])

    def __init__(self):
        QObject.__init__(self)
        self._localAPI = TaskhiveAPI()

    @pyqtSlot(QVariant, result=QVariant)
    def run(self, JSON_DATA):
        self._localAPI.create_bitmessage_api()
        task_JSON = JSON_DATA.toVariant()
        deadline = task_JSON['task_deadline'] + ' 23:59:59'
        formatted_d = datetime.datetime.strptime(deadline, '%d/%m/%Y %H:%M:%S')
        epoch_deadline = (formatted_d -
                          datetime.datetime(1970, 1, 1)).total_seconds()
        task_JSON['task_deadline'] = epoch_deadline
        self._localAPI.create_posting(task_JSON)
        self.taskStatus.emit({'status': 'sent'})
Beispiel #7
0
 def __init__(self):
     QObject.__init__(self)
     self._localAPI = TaskhiveAPI()
Beispiel #8
0
 def __init__(self):
     QObject.__init__(self)
     self.filters = []
     self._paused = False
     self._localAPI = TaskhiveAPI()
Beispiel #9
0
 def __init__(self, task_JSON):
     QObject.__init__(self)
     self._localAPI = TaskhiveAPI()
     self._JSON = task_JSON
Beispiel #10
0
 def __init__(self, task_id, from_add=None):
     QObject.__init__(self)
     self._localAPI = TaskhiveAPI()
     self.task_id = task_id
     self.from_add = from_add
Beispiel #11
0
  "task_payment_rate_type":"task",
  "task_payment_methods":[ "BTC", "DOGE"],
  "task_deadline":1482710400,
  "task_license":"CC BY 4.0",
  "task_escrow_required":1,
  "task_escrow_recommendation":"BITCOIN-PUBKEY",
  "task_address":"TEMP-BM-ADDRESS",
  "task_owner":"BITCOIN-PUBKEY",
  "task_id":"YsBGsF3dc9But9GN5mXOTwEFIZWZ8=",
  "task_entropy":"LATEST-BLOCKCHAIN-HASH",
  "task_expiration":1482710400
  }'''

if __name__ == "__main__":
    app = Taskhive(sys.argv)
    API = TaskhiveAPI()
    BitMessageAPI = API.run_bitmessage()
    time.sleep(10)
    BitMessage = API.create_bitmessage_api()
    if BitMessage in ['invalid keys_file settings', 'keyfile does not exist']:
        API.create_settings()
        BitMessage = API.create_bitmessage_api()
        BitMessageAPI = API.run_bitmessage()
    API.setup_channels()
    if API.run_bm.poll() is None:
        API.find_running_bitmessage_port()
    connections, _, _, _ = API.client_connections()
    # API.create_posting(test_json)
    # API.generate_and_store_keys()
    engine = QQmlApplicationEngine()