generated from itdominator/Python-With-Gtk-Template
Added new arg for statup; loading webkit after view is realized
This commit is contained in:
parent
43a1706a77
commit
e18f68c2b5
@ -27,7 +27,8 @@ if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
# Add long and short arguments
|
||||
parser.add_argument("--debug", "-d", default="false", help="Do extra console messaging.")
|
||||
parser.add_argument("--trace-debug", "-td", default="false", help="Disable saves, ignore IPC lock, do extra console messaging.")
|
||||
parser.add_argument("--trace-debug", "-td", default="false", help="Disable saves, ignore IPC lock, do extra console messaging; launch debug views.")
|
||||
parser.add_argument("--launch-inspector", "-li", default="false", help="Launch webkit debugging toopls.")
|
||||
parser.add_argument("--no-plugins", "-np", default="false", help="Do not load plugins.")
|
||||
parser.add_argument("--new-tab", "-t", default="", help="Open a file into new tab.")
|
||||
parser.add_argument("--new-window", "-w", default="", help="Open a file into a new window.")
|
||||
@ -41,6 +42,9 @@ if __name__ == "__main__":
|
||||
if args.trace_debug == "true":
|
||||
settings_manager.set_trace_debug(True)
|
||||
|
||||
if args.launch_inspector == "true":
|
||||
settings_manager.set_launch_inspector(True)
|
||||
|
||||
settings_manager.do_dirty_start_check()
|
||||
Application(args, unknownargs)
|
||||
except Exception as e:
|
||||
|
@ -27,12 +27,11 @@ class AceEditor(WebKit2.WebView):
|
||||
self._setup_styling()
|
||||
self._setup_signals()
|
||||
self._subscribe_to_events()
|
||||
self._load_view()
|
||||
self._setup_content_manager()
|
||||
|
||||
self.show_all()
|
||||
|
||||
if settings_manager.is_debug():
|
||||
if settings_manager.is_debug() or settings_manager.is_launch_inspector():
|
||||
inspector = self.get_inspector()
|
||||
inspector.show()
|
||||
|
||||
@ -42,7 +41,11 @@ class AceEditor(WebKit2.WebView):
|
||||
self.set_background_color( Gdk.RGBA(0, 0, 0, 0.0) )
|
||||
|
||||
def _setup_signals(self):
|
||||
...
|
||||
self._map_eve_id = self.connect("map", self._on_map_eve)
|
||||
|
||||
def _on_map_eve(self, widget):
|
||||
self.disconnect(self._map_eve_id)
|
||||
self._load_view()
|
||||
|
||||
def _subscribe_to_events(self):
|
||||
event_system.subscribe(f"load_file_{self.INDEX}", self.load_file)
|
||||
|
@ -138,6 +138,7 @@ class SettingsManager(StartCheckMixin, Singleton):
|
||||
|
||||
def is_trace_debug(self) -> str: return self._trace_debug
|
||||
def is_debug(self) -> str: return self._debug
|
||||
def is_launch_inspector(self) -> str: return self._run_inspector
|
||||
def is_starting_with_file(self) -> bool: return self._passed_in_file
|
||||
|
||||
def call_method(self, target_class = None, _method_name = None, data = None):
|
||||
@ -159,6 +160,9 @@ class SettingsManager(StartCheckMixin, Singleton):
|
||||
def set_debug(self, debug):
|
||||
self._debug = debug
|
||||
|
||||
def set_launch_inspector(self, launch):
|
||||
self._run_inspector = launch
|
||||
|
||||
def set_is_starting_with_file(self, is_passed_in_file: False):
|
||||
self._passed_in_file = is_passed_in_file
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user