Prusa MINI Firmware overview
auto_build.output_window Class Reference
Inheritance diagram for auto_build.output_window:
Collaboration diagram for auto_build.output_window:

Public Member Functions

def __init__ (self)
 
def start_thread (self)
 
def check_thread (self)
 
def update (self)
 
def scroll_errors (self, event)
 
def rebuild (self, event)
 
def copy (self, event)
 
def cut (self, event)
 
def cut (self, event)
 
def copy (self, event)
 
def select_all (self, event)
 

Public Attributes

 root
 
 frame
 
 popup
 
 secondary_thread
 
 filename
 

Static Public Attributes

bool continue_updates = True
 
string search_position = ''
 
bool error_found = False
 

Constructor & Destructor Documentation

◆ __init__()

def auto_build.output_window.__init__ (   self)
992  def __init__(self):
993 
994 
995  self.root = tk.Tk()
996  self.root.attributes("-topmost", True)
997  self.frame = tk.Frame(self.root)
998  self.frame.pack(fill='both', expand=True)
999 
1000  # text widget
1001  #self.text = tk.Text(self.frame, borderwidth=3, relief="sunken")
1002  Text.__init__(self, self.frame, borderwidth=3, relief="sunken")
1003  self.config(tabs=(400,)) # configure Text widget tab stops
1004  self.config(background = 'black', foreground = 'white', font= ("consolas", 12), wrap = 'word', undo = 'True')
1005  #self.config(background = 'black', foreground = 'white', font= ("consolas", 12), wrap = 'none', undo = 'True')
1006  self.config(height = 24, width = 100)
1007  self.config(insertbackground = 'pale green') # keyboard insertion point
1008  self.pack(side='left', fill='both', expand=True)
1009 
1010  self.tag_config('normal', foreground = 'white')
1011  self.tag_config('warning', foreground = 'yellow' )
1012  self.tag_config('error', foreground = 'red')
1013  self.tag_config('highlight_green', foreground = 'green')
1014  self.tag_config('highlight_blue', foreground = 'cyan')
1015  self.tag_config('error_highlight_inactive', background = 'dim gray')
1016  self.tag_config('error_highlight_active', background = 'light grey')
1017 
1018  self.bind_class("Text","<Control-a>", self.select_all) # required in windows, works in others
1019  self.bind_all("<Control-Shift-E>", self.scroll_errors)
1020  self.bind_class("<Control-Shift-R>", self.rebuild)
1021 
1022  # scrollbar
1023 
1024  scrb = tk.Scrollbar(self.frame, orient='vertical', command=self.yview)
1025  self.config(yscrollcommand=scrb.set)
1026  scrb.pack(side='right', fill='y')
1027 
1028  #self.scrb_Y = tk.Scrollbar(self.frame, orient='vertical', command=self.yview)
1029  #self.scrb_Y.config(yscrollcommand=self.scrb_Y.set)
1030  #self.scrb_Y.pack(side='right', fill='y')
1031 
1032  #self.scrb_X = tk.Scrollbar(self.frame, orient='horizontal', command=self.xview)
1033  #self.scrb_X.config(xscrollcommand=self.scrb_X.set)
1034  #self.scrb_X.pack(side='bottom', fill='x')
1035 
1036  #scrb_X = tk.Scrollbar(self, orient=tk.HORIZONTAL, command=self.xview) # tk.HORIZONTAL now have a horizsontal scroll bar BUT... shrinks it to a postage stamp and hides far right behind the vertical scroll bar
1037  #self.config(xscrollcommand=scrb_X.set)
1038  #scrb_X.pack(side='bottom', fill='x')
1039 
1040  #scrb= tk.Scrollbar(self, orient='vertical', command=self.yview)
1041  #self.config(yscrollcommand=scrb.set)
1042  #scrb.pack(side='right', fill='y')
1043 
1044  #self.config(height = 240, width = 1000) # didn't get the size baCK TO NORMAL
1045  #self.pack(side='left', fill='both', expand=True) # didn't get the size baCK TO NORMAL
1046 
1047 
1048  # pop-up menu
1049  self.popup = tk.Menu(self, tearoff=0)
1050 
1051  self.popup.add_command(label='Copy', command=self._copy)
1052  self.popup.add_command(label='Paste', command=self._paste)
1053  self.popup.add_separator()
1054  self.popup.add_command(label='Cut', command=self._cut)
1055  self.popup.add_separator()
1056  self.popup.add_command(label='Select All', command=self._select_all)
1057  self.popup.add_command(label='Clear All', command=self._clear_all)
1058  self.popup.add_separator()
1059  self.popup.add_command(label='Save As', command=self._file_save_as)
1060  self.popup.add_separator()
1061  #self.popup.add_command(label='Repeat Build(CTL-shift-r)', command=self._rebuild)
1062  self.popup.add_command(label='Repeat Build', command=self._rebuild)
1063  self.popup.add_separator()
1064  self.popup.add_command(label='Scroll Errors (CTL-shift-e)', command=self._scroll_errors)
1065  self.popup.add_separator()
1066  self.popup.add_command(label='Open File at Cursor', command=self._open_selected_file)
1067 
1068  if current_OS == 'Darwin': # MAC
1069  self.bind('<Button-2>', self._show_popup) # macOS only
1070  else:
1071  self.bind('<Button-3>', self._show_popup) # Windows & Linux
1072 
1073 

Member Function Documentation

◆ start_thread()

def auto_build.output_window.start_thread (   self)
1076  def start_thread(self, ):
1077  global continue_updates
1078  # create then start a secondary thread to run an arbitrary function
1079  # must have at least one argument
1080  self.secondary_thread = threading.Thread(target = lambda q, arg1: q.put(run_PIO(arg1)), args=(que, ''))
1081  self.secondary_thread.start()
1082  continue_updates = True
1083  # check the Queue in 50ms
1084  self.root.after(50, self.check_thread)
1085  self.root.after(50, self.update)
1086 
1087 
Here is the caller graph for this function:

◆ check_thread()

def auto_build.output_window.check_thread (   self)
1088  def check_thread(self): # wait for user to kill the window
1089  global continue_updates
1090  if continue_updates == True:
1091  self.root.after(10, self.check_thread)
1092 
1093 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update()

def auto_build.output_window.update (   self)
1094  def update(self):
1095  global continue_updates
1096  if continue_updates == True:
1097  self.root.after(10, self.update)#method is called every 50ms
1098  temp_text = ['0','0']
1099  if IO_queue.empty():
1100  if not(self.secondary_thread.is_alive()):
1101  continue_updates = False # queue is exhausted and thread is dead so no need for further updates
1102  else:
1103  try:
1104  temp_text = IO_queue.get(block = False)
1105  except Queue.Empty:
1106  continue_updates = False # queue is exhausted so no need for further updates
1107  else:
1108  self.insert('end', temp_text[0], temp_text[1])
1109  self.see("end") # make the last line visible (scroll text off the top)
1110 
1111 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ scroll_errors()

def auto_build.output_window.scroll_errors (   self,
  event 
)
1148  def scroll_errors(self, event):
1149  self._scroll_errors()
1150 
1151 
Here is the call graph for this function:

◆ rebuild()

def auto_build.output_window.rebuild (   self,
  event 
)
1160  def rebuild(self, event):
1161  print("event happened")
1162  self._rebuild()
1163 
1164 
Here is the call graph for this function:

◆ copy() [1/2]

def auto_build.output_window.copy (   self,
  event 
)
1190  def copy(self, event):
1191  try:
1192  selection = self.get(*self.tag_ranges('sel'))
1193  self.clipboard_clear()
1194  self.clipboard_append(selection)
1195  except TypeError:
1196  pass
1197 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cut() [1/2]

def auto_build.output_window.cut (   self,
  event 
)
1198  def cut(self, event):
1199 
1200  try:
1201  selection = self.get(*self.tag_ranges('sel'))
1202  self.clipboard_clear()
1203  self.clipboard_append(selection)
1204  self.delete(*self.tag_ranges('sel'))
1205  except TypeError:
1206  pass
1207 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cut() [2/2]

def auto_build.output_window.cut (   self,
  event 
)
1229  def cut(self, event):
1230  self._cut()
1231 
Here is the call graph for this function:

◆ copy() [2/2]

def auto_build.output_window.copy (   self,
  event 
)
1241  def copy(self, event):
1242  self._copy()
1243 
Here is the call graph for this function:

◆ select_all()

def auto_build.output_window.select_all (   self,
  event 
)
1252  def select_all(self, event):
1253  self.tag_add('sel', '1.0', 'end')
1254 
1255 

Member Data Documentation

◆ continue_updates

bool auto_build.output_window.continue_updates = True
static

◆ search_position

string auto_build.output_window.search_position = ''
static

◆ error_found

bool auto_build.output_window.error_found = False
static

◆ root

auto_build.output_window.root

◆ frame

auto_build.output_window.frame

◆ popup

auto_build.output_window.popup

◆ secondary_thread

auto_build.output_window.secondary_thread

◆ filename

auto_build.output_window.filename
g29_auto.start
start
Definition: g29_auto.py:150
auto_build.run_PIO
def run_PIO(dummy)
Definition: auto_build.py:876