Show terminal ID in page header
This commit is contained in:
		
							parent
							
								
									55203afc4d
								
							
						
					
					
						commit
						39abb0d648
					
				
					 3 changed files with 13 additions and 5 deletions
				
			
		|  | @ -36,6 +36,10 @@ from .feedback import WuttaFeedback | ||||||
| 
 | 
 | ||||||
| class WuttaHeader(WuttaControl): | class WuttaHeader(WuttaControl): | ||||||
| 
 | 
 | ||||||
|  |     def __init__(self, *args, **kwargs): | ||||||
|  |         self.term_display = kwargs.pop('term_display', '??') | ||||||
|  |         super().__init__(*args, **kwargs) | ||||||
|  | 
 | ||||||
|     def build(self): |     def build(self): | ||||||
|         self.txn_display = ft.Text("Txn: N", weight=ft.FontWeight.BOLD, size=20) |         self.txn_display = ft.Text("Txn: N", weight=ft.FontWeight.BOLD, size=20) | ||||||
|         self.cust_display = ft.Text("Cust: N", weight=ft.FontWeight.BOLD, size=20) |         self.cust_display = ft.Text("Cust: N", weight=ft.FontWeight.BOLD, size=20) | ||||||
|  | @ -55,6 +59,8 @@ class WuttaHeader(WuttaControl): | ||||||
|             ft.VerticalDivider(), |             ft.VerticalDivider(), | ||||||
|             self.logout_button, |             self.logout_button, | ||||||
|             self.logout_divider, |             self.logout_divider, | ||||||
|  |             ft.Text(f"Term: {self.term_display}", weight=ft.FontWeight.BOLD, size=20), | ||||||
|  |             ft.VerticalDivider(), | ||||||
|             self.title_button, |             self.title_button, | ||||||
|         ] |         ] | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -27,6 +27,7 @@ WuttaPOS - flet views (base class) | ||||||
| import flet as ft | import flet as ft | ||||||
| 
 | 
 | ||||||
| from wuttapos.controls.header import WuttaHeader | from wuttapos.controls.header import WuttaHeader | ||||||
|  | from wuttapos.util import get_pos_batch_handler | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class WuttaView(ft.View): | class WuttaView(ft.View): | ||||||
|  | @ -53,9 +54,14 @@ class WuttaView(ft.View): | ||||||
|         return [self.build_header()] |         return [self.build_header()] | ||||||
| 
 | 
 | ||||||
|     def build_header(self): |     def build_header(self): | ||||||
|         self.header = WuttaHeader(self.config, on_reset=self.reset) |         handler = self.get_batch_handler() | ||||||
|  |         self.header = WuttaHeader(self.config, on_reset=self.reset, | ||||||
|  |                                   term_display=handler.get_terminal_id() or '??') | ||||||
|         return self.header |         return self.header | ||||||
| 
 | 
 | ||||||
|  |     def get_batch_handler(self): | ||||||
|  |         return get_pos_batch_handler(self.config) | ||||||
|  | 
 | ||||||
|     def reset(self, *args, **kwargs): |     def reset(self, *args, **kwargs): | ||||||
|         pass |         pass | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -33,7 +33,6 @@ import flet as ft | ||||||
| from .base import WuttaView | from .base import WuttaView | ||||||
| from wuttapos.controls.custlookup import WuttaCustomerLookup | from wuttapos.controls.custlookup import WuttaCustomerLookup | ||||||
| from wuttapos.controls.itemlookup import WuttaProductLookup | from wuttapos.controls.itemlookup import WuttaProductLookup | ||||||
| from wuttapos.util import get_pos_batch_handler |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| log = logging.getLogger(__name__) | log = logging.getLogger(__name__) | ||||||
|  | @ -64,9 +63,6 @@ class POSView(WuttaView): | ||||||
|         for control in self.informed_controls: |         for control in self.informed_controls: | ||||||
|             control.informed_refresh() |             control.informed_refresh() | ||||||
| 
 | 
 | ||||||
|     def get_batch_handler(self): |  | ||||||
|         return get_pos_batch_handler(self.config) |  | ||||||
| 
 |  | ||||||
|     def reset(self, e=None, clear_quantity=True, update=True): |     def reset(self, e=None, clear_quantity=True, update=True): | ||||||
|         """ |         """ | ||||||
|         This is a convenience method, meant only to clear the main |         This is a convenience method, meant only to clear the main | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar