def show_result(self, action_result): if action_result is None: return for new_row in action_result.add_rows: self.tree.insert( '', 0, text=timestamps.time_to_gui_display(new_row.timestamp), values=(new_row.item, new_row.item_count, new_row.status, new_row.winner), iid=new_row.iid) for update_row in action_result.update_rows: self.tree.item(update_row.iid, values=(update_row.item, update_row.item_count, update_row.status, update_row.winner, update_row.warnings)) vals = self.tree.item(update_row.iid)['values'] if update_row.status == 'Concluded': message = '/rs {}'.format(update_row.winner) self.tree.item(update_row.iid, tags="charged") if update_row.warnings: self.tree.item(update_row.iid, tags="warning") self.master.clipboard_clear() self.master.clipboard_append(message) if update_row.status == 'Corrected': self.tree.item(update_row.iid, tags="corrected") if update_row.status == 'Error': self.tree.item(update_row.iid, tags="error") if update_row.status == 'Cancelled': self.tree.delete(update_row.iid) for message in action_result.status_messages: self.display_status_message(message)
def type_change(self, _event): if 'Time' == self.type_choice.get(): self.time_choice_menu.grid(row=1, column=0) self.time_choice.set( timestamps.time_to_gui_display( timestamps.pick_nearest_time(self.file_time))) else: self.time_choice_menu.grid_remove() pass
def show_raid_dumps(self): path = self.config.get('dump_path') if not os.path.exists(path): return raid_dump_files = sorted([x for x in os.listdir(path) if re.match(r'^RaidRoster_mangler-\d{8}-\d{6}.txt', x)]) for rdf in raid_dump_files: if rdf not in self.raid_dump_files: display_time = timestamps.time_to_gui_display(timestamps.time_from_raid_dump(rdf)) self.raid_dump_pane.insert('', 0, text=rdf, values=[display_time]) self.raid_dump_files.add(rdf) self.master.after(1000, self.show_raid_dumps)
def show_result(self, action_result): if action_result is None: return for new_row in action_result.add_rows: self.tree.insert('', 0, text=timestamps.time_to_gui_display(new_row.timestamp), values=(new_row.item, new_row.item_count, new_row.status, new_row.winner, new_row.price), iid=new_row.iid) for update_row in action_result.update_rows: self.tree.item(update_row.iid, values=(update_row.item, update_row.item_count, update_row.status, update_row.winner, update_row.price)) vals = self.tree.item(update_row.iid)['values'] if update_row.status == 'Concluded': message = '/rs Grats {} on {} for {} dkp'.format(vals[3], vals[0], vals[4]) self.master.clipboard_clear() self.master.clipboard_append(message) elif update_row.status == 'Tied': message = '/rs {} tied, hold a moment'.format(vals[3]) self.master.clipboard_clear() self.master.clipboard_append(message) for message in action_result.status_messages: self.display_status_message(message)
def test_timestamp_reversible(): """ we can convert a string to datetime and back and it will be unchanged """ test_s = "Jan 01 2020, 10:00 AM" assert timestamps.time_to_gui_display( (timestamps.time_from_gui_display(test_s))) == test_s
def test_time_to_gui_display_pm(): test_time = dt.datetime(month=1, day=1, year=2020, hour=20, minute=0) time_s = timestamps.time_to_gui_display(test_time) assert time_s == "Jan 01 2020, 08:00 PM"