fix disable web ui
This commit is contained in:
		
							parent
							
								
									ae289ec305
								
							
						
					
					
						commit
						f9a29d3140
					
				|  | @ -50,7 +50,7 @@ class Context(): | ||||||
| 
 | 
 | ||||||
|         self.ui_node = WebUI.WebUiClient() |         self.ui_node = WebUI.WebUiClient() | ||||||
|         self.custom_address = None |         self.custom_address = None | ||||||
|         self.webui_socket_port = port |         self.webui_socket_port: typing.Optional[int] = port | ||||||
| 
 | 
 | ||||||
|         self.exit_event = asyncio.Event() |         self.exit_event = asyncio.Event() | ||||||
|         self.watcher_event = asyncio.Event() |         self.watcher_event = asyncio.Event() | ||||||
|  | @ -1007,7 +1007,10 @@ class ClientCommandProcessor(CommandProcessor): | ||||||
|         self.ctx.ui_node.log_info(f"Setting slow mode to {self.ctx.slow_mode}") |         self.ctx.ui_node.log_info(f"Setting slow mode to {self.ctx.slow_mode}") | ||||||
| 
 | 
 | ||||||
|     def _cmd_web(self): |     def _cmd_web(self): | ||||||
|  |         if self.ctx.webui_socket_port: | ||||||
|             webbrowser.open(f'http://localhost:5050?port={self.ctx.webui_socket_port}') |             webbrowser.open(f'http://localhost:5050?port={self.ctx.webui_socket_port}') | ||||||
|  |         else: | ||||||
|  |             self.output("Web UI was never started.") | ||||||
| 
 | 
 | ||||||
|     def default(self, raw: str): |     def default(self, raw: str): | ||||||
|         asyncio.create_task(self.ctx.send_msgs([['Say', raw]])) |         asyncio.create_task(self.ctx.send_msgs([['Say', raw]])) | ||||||
|  | @ -1263,7 +1266,7 @@ async def main(): | ||||||
|     parser.add_argument('--disable_web_ui', default=False, action='store_true', help="Turn off emitting a webserver for the webbrowser based user interface.") |     parser.add_argument('--disable_web_ui', default=False, action='store_true', help="Turn off emitting a webserver for the webbrowser based user interface.") | ||||||
|     args = parser.parse_args() |     args = parser.parse_args() | ||||||
|     logging.basicConfig(format='%(message)s', level=getattr(logging, args.loglevel.upper(), logging.INFO)) |     logging.basicConfig(format='%(message)s', level=getattr(logging, args.loglevel.upper(), logging.INFO)) | ||||||
| 
 |     port = None | ||||||
|     if not args.disable_web_ui: |     if not args.disable_web_ui: | ||||||
|         # Find an available port on the host system to use for hosting the websocket server |         # Find an available port on the host system to use for hosting the websocket server | ||||||
|         while True: |         while True: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue