Ejemplo n.º 1
0
    def __init__(self, master):
        """
        Start the GUI and the asynchronous threads. We are in the main
        (original) thread of the application, which will later be used by
        the GUI. We spawn a new thread for the worker.
        """
        self.master = master

        # Create the queue
        self.queue = queue.Queue()

        # Set up the GUI part
        self.gui = GuiVend(master, self.queue, self.startVend)

        # Waiting for connection to dash thread
        self.c = self.connect()

        # Set up the thread to do asynchronous I/O
        # More can be made if necessary
        self.running = 1
        #conecct to listening
        self.connection = GuiListener(port=65449, dataQueue=self.queue)
        self.connection.start()
        #nije ni potrebno ako se stavi scree1 u konstruktor GUIVend
        #self.connection.onThread(self.connection.initScreen)

        # Start the periodic call in the GUI to check if the queue contains
        # anything
        self.periodicCall()
Ejemplo n.º 2
0
class ThreadedGUI:
    """
    Launch the main part of the GUI and the worker thread. periodicCall and
    endApplication could reside in the GUI, but putting them here
    means that you have all the thread controls in a single place.
    """
    def __init__(self, master):
        """
        Start the GUI and the asynchronous threads. We are in the main
        (original) thread of the application, which will later be used by
        the GUI. We spawn a new thread for the worker.
        """
        self.master = master

        # Create the queue
        self.queue = queue.Queue()

        # Set up the GUI part
        self.gui = GuiVend(master, self.queue, self.startVend)

        # Waiting for connection to dash thread
        self.c = self.connect()

        # Set up the thread to do asynchronous I/O
        # More can be made if necessary
        self.running = 1
        #conecct to listening
        self.connection = GuiListener(port=65449, dataQueue=self.queue)
        self.connection.start()
        #nije ni potrebno ako se stavi scree1 u konstruktor GUIVend
        #self.connection.onThread(self.connection.initScreen)

        # Start the periodic call in the GUI to check if the queue contains
        # anything
        self.periodicCall()

    def periodicCall(self):
        """
        Check every 100 ms if there is something new in the queue.
        """
        self.gui.processIncoming()
        if not self.running:
            import sys
            sys.exit(1)
        self.master.after(100, self.periodicCall)

    def startVend(self):
        print("starting vending process")
        self.c.sendMessage('startVend')

    def connect(self):
        while True:
            try:
                c = Client('127.0.0.1', 65448)
                return c
            except:
                pass
            print('Connecting...')
            sleep(1)
Ejemplo n.º 3
0
    except Exception as e:
        info(e)
    return


if __name__ == "__main__":
    config = configparser.ConfigParser()

    dashrpc = DashRPC(mainnet=MAINNET)

    vend = Vend()

    dataQueue = queue.PriorityQueue()

    #init GUI
    listener = GuiListener(65448, dataQueue)
    #DONE
    listener.setDaemon(True)
    listener.start()

    while True:
        try:
            c = Client('127.0.0.1', 65449)
            break
        except:
            pass
        print('Connecting...')
        time.sleep(1)
    # End init GUI

    info("connecting to dashd, waiting for masternode and budget sync")
Ejemplo n.º 4
0
    time.sleep(45)
    if waiting_transaction:
        c.sendMessage('waitingScreen')
    return

if __name__ == "__main__":
    config = configparser.ConfigParser()

    dashrpc = DashRPC(mainnet=MAINNET)

    vend = Vend()

    dataQueue = queue.PriorityQueue()

    #init GUI
    listener = GuiListener(65448, dataQueue)
    listener.start()

    while True:
        try:
            c = Client('127.0.0.1',65449)
            break
        except:
            pass
        print('Connecting...')
        time.sleep(1)
    # End init GUI

    info("connecting to dashd, waiting for masternode and budget sync")
    dashrpc.connect()
    while(not dashrpc.ready()):