Ejemplo n.º 1
0
    def draw(self, start_position: Vector2 = None):
        Printer.print_once("Initialized " + self.id + " in " + self.position.to_string() + " with size " +
                           self.size.to_string() + ". " + self.zone.to_string())

        if pygame.mouse.get_pressed()[0]:
            if self.zone.point_over(Vector2(pygame.mouse.get_pos()[0], pygame.mouse.get_pos()[1])):
                self.focused = True
            else:
                self.focused = False

        if self.focused:
            # Drawer.draw_border_rect(self.zone, self.style.focused_background_color, BorderStyle(
            #     self.style.focused_border_color, self.style.border_width), self.window)
            Drawer.draw_rounded_rect(self.zone, self.style.focused_background_color, self.window)

            if Time.millis() - self.__last_blink_shown > self.__blink_time:
                if self.__last_blink_shown:
                    # draw down line
                    pass
                else:
                    # don't draw line
                    pass
                self.__last_blink_shown = not self.__last_blink_shown

            Drawer.draw_text(self.zone.vector1 + Vector2(5, 5), Colors.black, self.text, self.font, self.window)

            print("Focused!")
        else:
            # Drawer.draw_border_rect(self.zone, self.style.background_color, BorderStyle(
            #     self.style.border_color, self.style.border_width), self.window)
            Drawer.draw_rounded_rect(self.zone, self.style.background_color, self.window)
            print("Unfocused!")
Ejemplo n.º 2
0
 def check(self):
     if Storage.plugins_queue is None:
         Printer.p(
             self.NAME,
             "Thread shuts down because plugins_queue is not defined.")
         return False
     return True
Ejemplo n.º 3
0
    def predict_timeframe(self,
                          start_time,
                          end_time,
                          request_ids=None,
                          ci=True):
        """
        Generates a dataframe of hourly predictions for the given location IDs within the requested timeframe.
        :param ci: Boolean parameter, defining if the user wants the confidence interval included in the prediction.
        :param request_ids: list of location IDs for prediction
        :param start_time: String of the starting date
        :param end_time: String of the ending date
        :return: dataframe with hourly predictions for each location
        """
        print("Generating predictions...")
        if request_ids is None:
            request_ids = range(self.avg_preds.shape[0])

        requests = self.__generate_pred_requests(start_time, end_time)
        data = pd.DataFrame()

        for i, request in enumerate(requests):
            Printer.loading_bar(int((i + 1) / (len(requests) / 100)))

            prediction = self.predict(request[0],
                                      request[1],
                                      request[2],
                                      request[3],
                                      locations=request_ids,
                                      ci=ci)
            data = data.append(prediction)

        return data
Ejemplo n.º 4
0
    def PrintLtr(self):
	#need consultant first and lastname by parsing self.consultant 
	conName = self.consultant[0:self.consultant.find(',')]
	Printer.myConsultLtr(self, self.PtID, self.textctrl['reason'].GetValue(), self.textctrl['memo'].GetValue(), \
				conName, self.textctrl['Due Date'])
	EMR_utilities.updateList(todo_find(self.PtID, toggle=0), self.todoInstance.todo_list)
	self.Destroy()
Ejemplo n.º 5
0
 def encryptNextFiles(self):
     Printer.verbosePrinter('tar ' + self.dir + ' -> ' + self.tarFile)
     Tar.tarDir(self.dir, self.tarFile)
     Printer.verbosePrinter('enc ' + self.tarFile + ' -> ' + self.outFile + ' with key ' + \
                             base64.urlsafe_b64encode(self.getNextKey()))
     CipherSuite(self.getNextKey()).encryptFile(self.tarFile, self.outFile)
     os.remove(self.tarFile)
Ejemplo n.º 6
0
 def decryptNextFiles(self, inAns):
     Printer.verbosePrinter('dec ' + self.encFile + ' -> ' + self.tarFile + ' with key ' + \
                             base64.urlsafe_b64encode(_getKey(inAns)))
     CipherSuite(_getKey(inAns)).decryptFile(self.encFile, self.tarFile)
     Printer.verbosePrinter('untar ' + self.tarFile + ' -> ' + self.outDir)
     Tar.untar(self.tarFile, self.outDir)
     os.remove(self.tarFile)
Ejemplo n.º 7
0
    def interpolate_data(self, data, filename='interpolation'):
        """
        Interpolates the given location counts onto a map.
        Saves the interpolated image to Images/Interpolation.png
        :param filename: name of the image file to be saved
        :param data: array with length 42, which represents the counts for each location (from the location dataframe).
        For more info on the locations, call the Predictor.dump_names() method.
        """

        zs = data.flatten()

        rbf = Rbf(self.xs, self.ys, zs, epsilon=3, smooth=5)

        data_map = np.ndarray((self.imshape_scaled[1], self.imshape_scaled[0]))
        total_count = data_map.shape[0] * data_map.shape[1]
        current_count = 0
        print("Building the interpolated map...")
        for x in range(data_map.shape[0]):
            for y in range(data_map.shape[1]):
                data_map[x, y] = rbf(x, y)
                current_count += 1

            Printer.loading_bar(int((current_count + 1) / (total_count / 100)))

        data_map -= np.min(data_map) - 1
        data_map_im = data_map / self.max
        data_image = Image.fromarray(np.uint8(self.colour_map(data_map_im) * 255))
        data_image = data_image.resize(self.imshape_original, Image.ANTIALIAS)
        data_image = Image.alpha_composite(data_image, self.overlay)

        data_image.save('Images/'+str(filename)+'.png', "PNG")
def checkPrinter():

    while (True):
        try:
            Printer.update()
        except:
            logging.exception('Exception in checkPrinter thread')
            raise
Ejemplo n.º 9
0
 def __init__(self, socket, team, port, ip):
     self.port = port
     self.ip = ip
     self.charactersCount = 0
     self.socket = socket
     self.team = team
     self._setTeamName()
     Printer.print_info(f"{self.teamName} as joined the game!")
Ejemplo n.º 10
0
def run_requester_threads(thread_number):
    for i in range(thread_number):
        thread = Requester(i, wordpress_url, plugins_directory,
                           sleep_between_req_in_milis, proxies,
                           basic_auth_user, basic_auth_password)
        thread.start()
        threads.append(thread)
    Printer.p(NAME, 'Requester threads started')
def checkPrinter():

    while(True):
        try:
            Printer.update()
        except:
            logging.exception('Exception in checkPrinter thread')
            raise
Ejemplo n.º 12
0
 def PrintLtr(self):
     #need consultant first and lastname by parsing self.consultant
     conName = self.consultant[0:self.consultant.find(',')]
     Printer.myConsultLtr(self, self.PtID, self.textctrl['reason'].GetValue(), self.textctrl['memo'].GetValue(), \
        conName, self.textctrl['Due Date'])
     EMR_utilities.updateList(todo_find(self.PtID, toggle=0),
                              self.todoInstance.todo_list)
     self.Destroy()
Ejemplo n.º 13
0
    def __init__(self,
                 log_file='/home/fargus/.backup_rsync.log',
                 config_file='/home/fargus/.backup_rsync.conf'):
        # calling super constructor
        super(Rsync_Wrapper, self).__init__()
        #  ## VARIABLES
        # this gets used sometimes
        self.title = 'Rsync Backup'
        # users home directory, ( this can be anything, but all dirs will be assumed to be in home dir)
        self.home_dir = None
        #  remote directory that all of the subfolders are stored in example: /mnt/user
        self.remote_home = None
        # the list of directories found in both the root of the google drive and in the users home dir
        self.dirs = []

        # log file shananagins
        self.log_file = log_file
        self.sp = p.SpoolPrinter(self.log_file)
        # ## END VARIABLES

        # ## CONFIG FILE CONFIGURATION
        try:
            config_file = config_file
            config_comments = 'I am writing this because every file in my home directory was deleted. I am now sad. Below write the directories you want to magically reappear if they are deleted They MUST be in the root directory of the Google Drive account that you have specified Also include full directories you fool This utility assumes you already have a valid rclone configuration. If you are unsure if you have this  please inform yourself. Because I am tired and sad and at school and its late and I want to finish this and go home. Dont give up hope and wash the dishes moron. ALSO THIS ONLY WORKS WITH DIRECTORIES IN YOUR HOME DIRECTORY'
            config_sections = [
                'remote_host', 'home_dir', 'directories', 'remote_home'
            ]

            # creating config file object
            import cfh
            cfh = cfh.cfh(config_file)

            # check for config file
            if not os.path.isfile(config_file):
                # if there is no config file, create it and exit
                p.print_header(self.title)
                self.sp.print_log(
                    'No config file found, generating config file')
                cfh.generate_conf(self.title, config_comments, config_sections)
                p.print_footer()
                exit(-1)

            # loading data from config
            config = cfh.read_conf()

            # getting rclone config, there should only be one element in this list, all else will be ignored
            self.remote_host = config['remote_host'][0]
            # remote home direcotry
            self.remote_home = config['remote_home'][0]
            # getting home dir, there should only be one element in this list, all else will be ignored
            self.home_dir = config['home_dir'][0]
            # getting directories
            self.dirs = config['directories']
        except Exception as e:
            self.sp.print_log('Error with config: %s' % str(e))
            self.sp.print_log('Exiting')
            exit(-1)
Ejemplo n.º 14
0
def updateContent(contentProvider):
    content = contentProvider.getNextContent()
    content.updateContent()
    contentToDisplay = content.getContent()
    ipList = ['192.168.1.21', '192.168.1.20']
    for ip in ipList:
        p = Printer(ip)
        # p.tryReadyMessage(contentToDisplay)
        p.setReadyMessage(contentToDisplay)
Ejemplo n.º 15
0
def updateContent(contentProvider):
	content = contentProvider.getNextContent()
	content.updateContent()
	contentToDisplay = content.getContent()
	ipList = ['192.168.1.21','192.168.1.20']
	for ip in ipList:
		p = Printer(ip)
		# p.tryReadyMessage(contentToDisplay)
		p.setReadyMessage(contentToDisplay)
Ejemplo n.º 16
0
    def scan(self, window=None):
        if window:
            self.display = Display(window, self)
        else:
            self.display = None

        if not self.scanner_options.input_file:
            timeout = 5
        else:
            timeout = None

        if self.scanner_options.channel_hop:
            self.scanner_options.channel = randint(
                1, self.scanner_options.max_channel)
            self.set_channel(self.scanner_options.channel)
        elif -1 != self.scanner_options.channel:
            self.set_channel(self.scanner_options.channel)

        while True:
            try:
                sniff(iface=self.scanner_options.iface,
                      store=False,
                      count=self.scanner_options.packet_count,
                      offline=self.scanner_options.input_file,
                      timeout=timeout,
                      lfilter=self._filter_function)
                if timeout:
                    try:
                        ch = self.display.window.getkey()
                        if 'q' == ch:
                            break
                    except:
                        pass

                    if self.display:
                        self.display.update_header()

                    if self.scanner_options.channel_hop:
                        self.scanner_options.channel = (
                            (self.scanner_options.channel + 3) %
                            self.scanner_options.max_channel) + 1
                        self.set_channel(self.scanner_options.channel)
                else:
                    break

            # Exit the scan on a keyboard break
            except KeyboardInterrupt:
                break

            # Curses generates system interupt exception (EINTR) when the window is resized
            except Exception as e:
                if e.args and e.args[0] == errno.EINTR:
                    pass
                else:
                    Printer.exception(e)
                    raise
Ejemplo n.º 17
0
def receiveFromServer(TCPSocket):
    while (1):
        try:
            sentence = TCPSocket.recv(bufferSize)

            if not sentence:
                return
            Printer.print_to_client_screen_orange(sentence.decode('utf-8'))
        except:
            return
Ejemplo n.º 18
0
    def set_channel(self, channel):
        Printer.verbose('CHAN: set_channel {0}'.format(channel),
                        verbose_level=3)
        try:
            self.scanner_options.we.set_channel(channel)
        except Exception as e:
            Printer.exception(e)

        if self.display:
            self.display.update_header()
Ejemplo n.º 19
0
def main(argv):
    urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning
                             )  # disable warnings about untrusted certificate
    read_arguments(argv)
    Printer.p(NAME, "Scan method: " + scan_method)
    if scan_method.upper() == "ALL":
        all_scan()
    elif scan_method.upper() == "POPULAR":
        popular_scan()
    else:
        Printer.p(NAME, 'Invalid scan method.')
Ejemplo n.º 20
0
    def __init__(self, adapter):
        self._simple = Demo.Simple()
        self._simple.message = "a message 4 u"

        self._printer = Printer.PrinterI()
        self._printer.message = "Ice rulez!"
        self._printerProxy = Demo.PrinterPrx.uncheckedCast(adapter.addWithUUID(self._printer))

        self._derivedPrinter = Printer.DerivedPrinterI()
        self._derivedPrinter.message = self._printer.message
        self._derivedPrinter.derivedMessage = "a derived message 4 u"
        adapter.addWithUUID(self._derivedPrinter)
Ejemplo n.º 21
0
def analyzeBroadcatMessage(msg):
    try:
        cookie_offer_port = unpack('!IcH', msg)
        if (cookie_offer_port[0] == cookie_number
                and cookie_offer_port[1] == bytes([offer_number])):
            return cookie_offer_port[2]
        Printer.print_to_client_screen_green(
            f"Received unexpected broadcast message")
    except:
        Printer.print_to_client_screen_green(
            f"Received unexpected broadcast message")
    return
Ejemplo n.º 22
0
	def __init__(self):
		self.conf = Helper.Config()
		self.printer = Printer.AplicationPrinter()
		self.bigtickerfreq = self.conf.bigtickerfreq
		self.candlestickLenght = self.conf.candlestickLenght
		self.tradingStart = self.conf.overalldatalenght
		self.candle_ID = 1
		self.alltickersbiglist = []
		self.datacollectingprinter = Printer.DataCollectingPrinter()
		self.checkconsistence = DataConsistence.CheckConsistence()
		self.decisionspid = None
		self.closes = {}
		self.bigbud2keep = []
Ejemplo n.º 23
0
    def compare(self,
                p_v=True,
                p_r=True,
                p_t=True,
                static_validations=None,
                static_rtypes=None,
                test_in=[]):
        self.comp.current_version = self.gen.current_file_name
        self.comp.test_res = self.gen.test_res
        self.comp.new_v_file = self.gen.new_v_file
        self.comp.new_r_file = self.gen.new_r_file

        if p_v == True:
            out = self.comp.static_valid_analysis(static_validations)
            for i in out:
                Printer.info_print(i)
        if p_r == True:
            out = self.comp.static_rtypes_analysis(static_rtypes)
            for i in out:
                Printer.info_print(i)
        if p_t == True:
            out = self.comp.test_analysis()
            for i in out:
                if i[0] == 'INFO':
                    Printer.info_print(i[1])
                else:
                    Printer.warn_print(i[1])
Ejemplo n.º 24
0
class IOManager(object):
    def __init__(self):
        led = 11
        button = 13
        GPIO.setmode(GPIO.BOARD)
        GPIO.setup(led, GPIO.OUT)

        self.__scanner = Scanner()
        self.__button = Button(button)
        self.__led = LED(led)
        self.__printer = Printer()
        #set up connections and variables for button, light, printer, and scanner
    def getButton(self):
        return self.__button.getButtonBool()

    def getScan(self):
        return self.__scanner.getInput()

    def setLight(self, value):
        self.__led.setValue(value)

    def blinkLight(self):
        self.__led.blink()
        
    def printReceipt(self, items):
        if items:
            self.__printer.printHeader()
            for item in items:
                self.__printer.printItem(item)
            self.__printer.printTotals(items)
            self.__printer.complete()
Ejemplo n.º 25
0
def all_scan():
    NAME = "ALL_SCAN"
    if all_out_file is None or not os.path.isfile(all_out_file):
        Printer.p(NAME,
                  all_out_file + ' file not found! Scan will not be started!',
                  1)
        Printer.p(NAME, 'Have you run `python3 crawlall.py`?', 1)
        return
    Printer.p(NAME, "started...", 1)
    Printer.p(NAME, 'creating blocking queue')
    load_file_to_queue(all_out_file)
    run_requester_threads(number_of_requester_threads)
    wait_for_threads()
    Printer.p(NAME, "finished. Results saved in " + Config.FOUND_OUTPUT_FILE,
              0)
Ejemplo n.º 26
0
    def _update_stations(self, packet):
        show = False

        bssid = packet[Dot11].sta_bssid()
        if bssid in self.stations:
            station = self.stations[bssid]
        else:
            station = self.stations[bssid] = Station(bssid)
            show = True
        station.update(packet)

        if show:
            Printer.verbose(station.show(), verbose_level=2)

        return station
    def update(self):
        self.lines[0] = list(self.tool.center(Lcd.width))
        self.lines[1] = list("+10".center(Lcd.width))
        self.lines[2] = list("-1 {: =3d} +1".format(self.temp).center(Lcd.width))
        self.lines[3] = list("-10".center(Lcd.width))

        if Hardware.buttons["up"]:
            self.temp = self.temp + 10
        if Hardware.buttons["down"]:
            self.temp = self.temp - 10
        if Hardware.buttons["left"]:
            self.temp = self.temp - 1
        if Hardware.buttons["right"]:
            self.temp = self.temp + 1
        if Hardware.buttons["enter"]:
            Printer.setTemp(self.tool, self.temp)
Ejemplo n.º 28
0
class Game:

    printer = Printer()

    def win(self, hero1, hero2):
        if hero1.level > hero2.level:
            print "Gana : ", hero1.name, hero1.level
            self.printer.printIcon(hero1)
        else:
            print "Gana : ", hero2.name, hero2.level
            self.printer.printIcon(hero2)

    def fight(self, hero1, hero2, sense):
        count = 0
        while count < True:
            if r.random() >= 0.5:
                hero1.level = hero1.level - 1
                self.printer.printIcon(hero2, sense)
                print "Golpe ", hero2.name, hero2.level
            else:
                hero2.level = hero2.level - 1
                self.printer.printIcon(hero1, sense)
                print "Golpe ", hero1.name, hero1.level
            if hero1.level <= 0 or hero2.level <= 0:
                self.win(hero1, hero2)
                return 0
            t.sleep(.5)
Ejemplo n.º 29
0
def solve(inLevel, inAnswer, encDir, decDir):
    with open(os.path.join(encDir, 'enc.json'), 'r') as fIn:
        inputDict = json.loads(fIn.read())

    if str(inLevel) not in inputDict:
        print "No such level found"
        exit(-1)

    print "Found level " + str(inLevel) + \
               Printer.verboseAddition(": " + str(inputDict[str(inLevel)]))
    solver = Solver(inLevel, inputDict[str(inLevel)])

    if solver.isAnswerCorrect(inAnswer):
        print "Correct answer given"
    else:
        print "Incorrect answer given"
        exit(-1)

    if str(inLevel + 1) not in inputDict:
        print "Congrats! You have solved all the puzzles"
        return

    solver.decryptNextFiles(inAnswer)

    print "Decrypting level " + str(inLevel + 1) + " files"
    print "Resulting files can be found at " + solver.outDir
Ejemplo n.º 30
0
def Simulation(nom_of_seconds, pages_per_minute):
    labprinter = Printer(pages_per_minute)
    waiting_times = []
    printer_queue = Queue()

    for current_second in range(nom_of_seconds):
        if random.randrange(
                1,
                91) == 5:  #91 if there are 20 students on avg, 181 if 10 only
            task = Task(current_second)
            printer_queue.enqueue(task)
            #print(current_second,task.getpages())

        if (not printer_queue.is_empty() and (not labprinter.busy())):

            new_task = printer_queue.dequeue()

            waiting_times.append(new_task.wait_time(current_second))

            labprinter.start_next(new_task)

            #print(new_task.wait_time(current_second))

        labprinter.tick()

    #print(waiting_times,'len is ',len(waiting_times))
    return printer_queue.size(), round(
        sum(waiting_times) / len(waiting_times), 2)
Ejemplo n.º 31
0
    def generate_conf(self, fl_name, comments, section_ls):

        # Validating
        # s.check_str(fl_name)
        # s.check_str(comments)
        # s.check_list(section_ls)

        # Making spool printer
        sp = SpoolPrinter(self.target, overwrite=True)

        # Making new file if one does not already exist
        if not fo.verify_file_exists(self.target):
            sp.overwrite_file()

        # Printing header
        sp.println(p.print_header(fl_name))

        # Generating comments, line by line
        comments_ls = comments.split(' ')
        y = 0
        line_str = ''
        words_per_line = 8
        for x in comments_ls:
            line_str += ' ' + str(x)
            y += 1
            if y > words_per_line:
                sp.println('#' + str(line_str))
                y = 0
                line_str = ''

        # Adding breathing room gap before section starts
        sp.println('')

        # Starting Sections
        for x in section_ls:
            sp.println('[' + str(x) + ']')
            sp.println(' ')
            sp.println(' ')
            sp.println(' ')

        # THE END IS NEAR
        sp.println('[end]')

        sp.println(p.print_footer('Sekhnet'))
Ejemplo n.º 32
0
    def __init__(self):
        led = 11
        button = 13
        GPIO.setmode(GPIO.BOARD)
        GPIO.setup(led, GPIO.OUT)

        self.__scanner = Scanner()
        self.__button = Button(button)
        self.__led = LED(led)
        self.__printer = Printer()
Ejemplo n.º 33
0
    def update(self, packet):
        essid = packet[Dot11].essid()
        if essid:
            self.essid = essid

        self.channel = packet[Dot11].channel() or packet[RadioTap].Channel

        is_beacon = packet.haslayer(Dot11Beacon)
        is_probe_resp = packet.haslayer(Dot11ProbeResp)

        if is_beacon:
            self.beacon_count += 1
            self.hidden_essid = (not essid)

            if packet.hasflag('cap', 'privacy'):
                elt_rsn = packet[Dot11].rsn()
                if elt_rsn:
                    Printer.write('Packets has RSN')
                    self.enc = elt_rsn.enc
                    self.cipher = elt_rsn.cipher
                    self.auth = elt_rsn.auth
                else:
                    self.enc = 'WEP'
                    self.cipher = 'WEP'
                    self.auth = ''
            else:
                self.enc = 'OPN'
                self.cipher = ''
                self.auth = ''

        elif is_probe_resp:
            self.sta_bssids.add(packet[Dot11].sta_bssid())

        if is_beacon or is_probe_resp:
            rates = packet[Dot11].rates()
            rates.extend(packet[Dot11].extended_rates())
            if rates:
                self.max_rate = max(rates)

        if self.bssid == packet[Dot11].addr2:
            power = packet[RadioTap].dBm_AntSignal
            if power:
                self.power = power
Ejemplo n.º 34
0
 def printSimplified(self):
     """Simplified ticket printer."""
     if self.orderTotal.getTotal() > 0:
         self.setTime()
         ticket = Ticket.Ticket(self.collector(), self, simplified=True)
         # if ticket.exec_():
         #     pass
         printer = Printer.Print()
         printer.Print(ticket, simplified=True)
         printer = None
         ticket.setParent(None)
Ejemplo n.º 35
0
    def print_results(self):
        Printer.write('\n\n')
        Printer.write(
            '{0:<18} {1:>3} {2:5} {3:5} {4:2} {5:<4} {6:<4} {7:<4} {8:<4} {9:3} {10:<32}'
            .format('BSSID', 'PWR', '#BEAC', '#DATA', 'CH', 'MB', 'ENC',
                    'CIPH', 'AUTH', 'HID', 'ESSID'))
        for access_point in self.access_points.values():
            Printer.write(
                access_point.show(bssid_to_essid=self.bssid_to_essid))

        for bssid, station in self.stations.iteritems():
            if len(station.probes) or len(station.auth_reqs):
                Printer.write(station.show(bssid_to_essid=self.bssid_to_essid))
Ejemplo n.º 36
0
	def printWorldState(self):
		if repeatedState(self.story.edge):
			styler.printHeader("Current World State - REPEATED")
		else:	
			styler.printHeader("Current World State")
		for e in self.story.edge:
			print styler.printState(e)
    def update(self):
        f = Printer.files["files"][Printer.tmpFile]
        self.lines[0] = f["name"].center(20)
        
        time = []
        size = []
        date = []
        orig = []
        
        if "gcodeAnalysis" in f and not f["gcodeAnalysis"]["estimatedPrintTime"] == None:
            m, s = divmod(int(f["gcodeAnalysis"]["estimatedPrintTime"]), 60)
            h, m = divmod(m, 60)
            time = list(str("%02d:%02d:%02d" % (h, m, s)).center(Lcd.width/2))
        else:
            time = list("".center(Lcd.width/2))
        
        if not f["size"] == None:
            s = filesize.size(int(str(f["size"])))
            size = list(str(s).center(Lcd.width/2))
        else:
            size = list("".center(Lcd.width/2))
        
        if not f["date"] == None:
            d = datetime.datetime.fromtimestamp(int(f["date"])).strftime('%m/%d/%Y')
            date = list(d.center(Lcd.width/2))
        else:
            date = list("".center(Lcd.width/2))
        
        if not f["origin"] == None:
            orig = list(str(f["origin"]).center(Lcd.width/2))
        else:
            orig = list("".center(Lcd.width/2))

        self.lines[1] = time+date
        self.lines[2] = size+orig
        
        self.lines[3] = list(" Print  Load  Delete")
        
        if Hardware.buttons["right"] and self.pos < 3:
            self.pos = self.pos + 1
        if Hardware.buttons["left"] and self.pos > -1:
            self.pos = self.pos - 1
        
        if self.pos == 0:
            self.lines[3][0] = '>'
        elif self.pos == 1:
            self.lines[3][7] = '>'
        elif self.pos == 2:
            self.lines[3][13] = '>'
        else:
            self.pos = 0
            self.lines[3][0] = '>'
        
        if Hardware.buttons["enter"]:
            if self.pos == 0:
                Printer.selectFile(f["name"], f["origin"], True)
            elif self.pos == 1:
                Printer.selectFile(f["name"], f["origin"], False)
            elif self.pos == 2:
                Printer.deleteFile(f["name"], f["origin"])
Ejemplo n.º 38
0
	inp = -1
	while(inp != 0):
		# clear screen on each iteration of story.. for readability
		# UNIX based systems
		try:
			subprocess.call(['clear'])
		except OSError:
			pass
		# Windows systems
		try:
			subprocess.call(['cls'])
		except OSError:
			pass

		# print the story so far
		styler.printHeader("Story so far")
		print storyText

		# print current set of valid conditions in the world
		p.printWorldState()

		# present list of valid conditions in current world
		actions = p.nextActions(True)
		styler.printHeader("Select from following actions")
		
		print styler.printAction(0,"Exit")

		for i in range(len(actions)):
			print styler.printAction(i+1,actions[i])
		try:
			# check if previous action counted towards us failed goal.
Ejemplo n.º 39
0
    def OnBillPt(self, event):
	Printer.myPtBill(self.PtID)
	EMR_utilities.updateData('UPDATE billing SET ptDate = CURDATE() WHERE patient_ID = %s AND balance > 0;' % (self.PtID))
Ejemplo n.º 40
0
	def printWorld(self):
		for edge in self.story.actions:
			print styler.printState(edge)
Ejemplo n.º 41
0
    def OnTest(self, event):
	Printer.myTestOrder(self, self.PtID)

	"""lt = "%s/EMR_outputs/Tests.html" % settings.LINUXPATH
Ejemplo n.º 42
0
	elif option=='-lc':
		# conectate a un archivo de lineas de texto, cada linea es el texto de un tweet
		if len(sys.argv)==3:
			corpus_lf=sys.argv[2]
		connection=nerit.getDataLineConnection(corpus_lf)

	elif option=='-fc':
		# la considero una opcion menos requerida, pero mas bien para mostrar que el disenio permite multiples conexiones
		# conectar a un archivo de tweets ( completos, es decir en Json )
		if len(sys.argv)==3:
			corpus_cf=sys.argv[2]
		connection=nerit.getFileConnection(corpus_cf)
	

	if connection:
		# enchufar ultima etapa al pipeline 
		final_stage=Printer()
		# indicarle que frases quiero que imprima
		final_stage.set_target_chunks(phrases_to_print)
		createPipeline(nerit,connection,tokenizers_file,abbreviations,post_model,chunk_model,save_to,strFilter,corpus_size,final_stage)
		# salir andando...
		
except IndexError:
	usage()