]> git.neil.brown.name Git - edlib.git/commitdiff
pygtk: discard new_display2
authorNeilBrown <neil@brown.name>
Wed, 28 Jun 2023 21:01:46 +0000 (07:01 +1000)
committerNeilBrown <neil@brown.name>
Wed, 28 Jun 2023 21:03:48 +0000 (07:03 +1000)
new_display and new_display2 are now sufficiently similar that we can
merge them.

Signed-off-by: NeilBrown <neil@brown.name>
modules.ini
python/display-pygtk.py

index dffab4ba1522b3d1135ee6f566e8c1f5bb9fab30..c188cb41cfb0263aa10821e4b37a6b910821f8d0 100644 (file)
@@ -27,7 +27,7 @@ display-x11-xcb =
        interactive-cmd-x11window
        attach-display-x11
 display-pygtk =
-       interactice-cmd-gtkwindow
+       interactive-cmd-gtkwindow
        attach-display-gtk
 
 render-hex =
index 6638c2c46d606aee4ef470a047842b4bb25ba444..e93ddd0d7535e98996952bac8f377604a0612681 100644 (file)
@@ -737,8 +737,12 @@ class EdDisplay(edlib.Pane):
         edlib.time_stop(edlib.TIME_KEY)
 
 def new_display(key, focus, comm2, str1, **a):
-    if not str1:
-        return None
+    display = str1
+    if not display:
+        display = focus['DISPLAY']
+        if not display:
+            return None
+
     focus.call("attach-glibevents")
     ed = focus.root
 
@@ -747,30 +751,13 @@ def new_display(key, focus, comm2, str1, **a):
         s = Gtk.settings_get_default()
         s.set_long_property("Gtk-xft-dpi",sc*Pango.SCALE, "code")
 
-    disp = EdDisplay(focus, str1)
+    disp = EdDisplay(ed, display)
     p = disp.call("editor:activate-display", ret='pane')
     if p and focus != ed:
         p = focus.call("doc:attach-view", p, 1)
-    comm2('callback', p)
-    return 1
-
-def new_display2(key, focus, **a):
-    display = focus['DISPLAY']
-    if not display:
-        return None
-    p = focus.root
-    p.call("attach-glibevents")
-
-    if 'SCALE' in os.environ:
-        sc = int(os.environ['SCALE'])
-        s = Gtk.settings_get_default()
-        s.set_long_property("Gtk-xft-dpi",sc*Pango.SCALE, "code")
-
-    disp = EdDisplay(p, display)
-    p = disp.call("editor:activate-display", ret='pane')
-    if p:
-        focus.call("doc:attach-view", p, 1);
+    if comm2:
+        comm2('callback', p)
     return 1
 
 edlib.editor.call("global-set-command", "attach-display-gtk", new_display)
-edlib.editor.call("global-set-command", "interactive-cmd-gtkwindow", new_display2)
+edlib.editor.call("global-set-command", "interactive-cmd-gtkwindow", new_display)