GNOME Bugzilla – Bug 640075
Port commander to libpeas/gtk
Last modified: 2019-03-23 20:33:55 UTC
First patch for the commander port.
Created attachment 178851 [details] [review] Port commander to libpeas/gtk3
Created attachment 178918 [details] [review] Port commander to libpeas/gtk3
Review of attachment 178918 [details] [review]: See inline comments. Some stuff probably just depends on things not working yet in pygi (like expose -> draw). ::: plugins/commander/commander/entry.py @@ +58,3 @@ + + self._entry = Gtk.Entry() + self._entry.modify_font(font_desc) use override_font @@ +64,3 @@ + # Set the same text color as the text view + self._entry.override_color(0, context.get_color(state)) Use Gtk.StateFlag (btw, 0 is the Active state, seems wrong) @@ +71,3 @@ self._entry.show() + self._prompt_label = Gtk.Label(label='<b>>>></b>') Maybe use markup= here? @@ +79,3 @@ + context.add_class(Gtk.STYLE_CLASS_VIEW) + label_color = context.get_color(0) + self._prompt_label.override_color(0, label_color) use state flag @@ +83,3 @@ + + self.override_background_color(0, self.background_gdk()) + self._entry.override_background_color(0, self.background_gdk()) use state flag @@ +124,3 @@ return self._view def on_realize(self, widget): Replace with do_realize @@ +143,3 @@ + #ct.rectangle(evnt.area.x, evnt.area.y, evnt.area.width, evnt.area.height) + #ct.clip() Why? @@ +176,3 @@ + gdk_bg.red = bg[0] / 65535 + gdk_bg.green = bg[1] / 65535 + gdk_bg.blue = bg[2] / 65535 This is a bit pointless :) First the color is multiplied by 65535 and then divided again... ::: plugins/commander/commander/info.py @@ +40,2 @@ self._text.modify_font(entry._view.style.font_desc) + self._text.modify_text(Gtk.StateType.NORMAL, entry._entry.style.text[Gtk.StateType.NORMAL]) Does this work? Seems it needs to be changed to use style context @@ +92,3 @@ def status(self, text=None): if self._status_label == None and text != None: + self._status_label = Gtk.Label(label='') Empty constructor will probably work no? @@ +95,2 @@ self._status_label.modify_font(self._text.style.font_desc) + self._status_label.modify_fg(Gtk.StateType.NORMAL, self._text.style.text[Gtk.StateType.NORMAL]) Deprecated @@ +200,3 @@ def ensure_button_bar(self): if not self._button_bar: + self._button_bar = Gtk.HBox(False, 3) Use Gtk.Box(orientation stuff @@ +262,3 @@ return False + ct = evnt.get_window().cairo_create() Expose -> draw @@ +276,2 @@ def on_text_realize(self, widget): + self._text.get_window(Gtk.TextWindowType.TEXT).set_back_pixmap(None, False) I guess set_back_pixmap wont work anymore @@ +308,3 @@ return True + ct = evnt.get_window().cairo_create() Expose -> draw ::: plugins/commander/commander/transparentwindow.py @@ +47,2 @@ def on_realize(self, widget): + self.get_window().set_back_pixmap(None, False) Does set_back_pixmap still exist? @@ +77,2 @@ def on_expose(self, widget, evnt): + if not self.get_window(): Expose -> draw ::: plugins/commander/modules/doc.py @@ +91,3 @@ self.iter = iter + bus = self.get_window().get_message_bus() Does the bus actually work? ::: plugins/commander/modules/edit.py @@ +55,3 @@ if matches: for match in matches: + files.append(Gio.File(match)) Does this work, or does it need to new Gio.File constructor thingie @@ +58,2 @@ else: + files.append(Gio.File(filename)) Idem @@ +93,2 @@ if os.path.isabs(newfile): + dest = Gio.File(newfile) Idem @@ +134,3 @@ def _edit_command(view, mod, func=None): try: + location = Gio.File(inspect.getsourcefile(mod)) Idem
(In reply to comment #3) > Review of attachment 178918 [details] [review]: > > See inline comments. Some stuff probably just depends on things not working yet > in pygi (like expose -> draw). > > ::: plugins/commander/commander/entry.py > @@ +58,3 @@ > + > + self._entry = Gtk.Entry() > + self._entry.modify_font(font_desc) > > use override_font right > > @@ +64,3 @@ > > + # Set the same text color as the text view > + self._entry.override_color(0, context.get_color(state)) > > Use Gtk.StateFlag (btw, 0 is the Active state, seems wrong) > > @@ +71,3 @@ > self._entry.show() > > + self._prompt_label = Gtk.Label(label='<b>>>></b>') > > Maybe use markup= here? > > @@ +79,3 @@ > + context.add_class(Gtk.STYLE_CLASS_VIEW) > + label_color = context.get_color(0) > + self._prompt_label.override_color(0, label_color) > > use state flag > > @@ +83,3 @@ > + > + self.override_background_color(0, self.background_gdk()) > + self._entry.override_background_color(0, self.background_gdk()) > > use state flag > > @@ +124,3 @@ > return self._view > > def on_realize(self, widget): > > Replace with do_realize > > @@ +143,3 @@ > > + #ct.rectangle(evnt.area.x, evnt.area.y, evnt.area.width, > evnt.area.height) > + #ct.clip() > > Why? This didn't work with the current pygobject, but it should be added back > > @@ +176,3 @@ > + gdk_bg.red = bg[0] / 65535 > + gdk_bg.green = bg[1] / 65535 > + gdk_bg.blue = bg[2] / 65535 > > This is a bit pointless :) First the color is multiplied by 65535 and then > divided again... Yeah, I fixed this in multi-edit and I thought I did it here too. > > ::: plugins/commander/commander/info.py > @@ +40,2 @@ > self._text.modify_font(entry._view.style.font_desc) > + self._text.modify_text(Gtk.StateType.NORMAL, > entry._entry.style.text[Gtk.StateType.NORMAL]) > > Does this work? Seems it needs to be changed to use style context For sure it doesn't but I couldn't reach this part of the code when testing > > @@ +92,3 @@ > def status(self, text=None): > if self._status_label == None and text != None: > + self._status_label = Gtk.Label(label='') > > Empty constructor will probably work no? > > @@ +95,2 @@ > self._status_label.modify_font(self._text.style.font_desc) > + self._status_label.modify_fg(Gtk.StateType.NORMAL, > self._text.style.text[Gtk.StateType.NORMAL]) > > Deprecated > > @@ +200,3 @@ > def ensure_button_bar(self): > if not self._button_bar: > + self._button_bar = Gtk.HBox(False, 3) > > Use Gtk.Box(orientation stuff > > @@ +262,3 @@ > return False > > + ct = evnt.get_window().cairo_create() > > Expose -> draw > > @@ +276,2 @@ > def on_text_realize(self, widget): > + self._text.get_window(Gtk.TextWindowType.TEXT).set_back_pixmap(None, > False) > > I guess set_back_pixmap wont work anymore > > @@ +308,3 @@ > return True > > + ct = evnt.get_window().cairo_create() > > Expose -> draw > > ::: plugins/commander/commander/transparentwindow.py > @@ +47,2 @@ > def on_realize(self, widget): > + self.get_window().set_back_pixmap(None, False) > > Does set_back_pixmap still exist? > > @@ +77,2 @@ > def on_expose(self, widget, evnt): > + if not self.get_window(): > > Expose -> draw > > ::: plugins/commander/modules/doc.py > @@ +91,3 @@ > self.iter = iter > > + bus = self.get_window().get_message_bus() > > Does the bus actually work? > > ::: plugins/commander/modules/edit.py > @@ +55,3 @@ > if matches: > for match in matches: > + files.append(Gio.File(match)) > > Does this work, or does it need to new Gio.File constructor thingie > > @@ +58,2 @@ > else: > + files.append(Gio.File(filename)) > > Idem > > @@ +93,2 @@ > if os.path.isabs(newfile): > + dest = Gio.File(newfile) > > Idem > > @@ +134,3 @@ > def _edit_command(view, mod, func=None): > try: > + location = Gio.File(inspect.getsourcefile(mod)) > > Idem Most of it is shit left by the converter script.
Created attachment 184359 [details] [review] commander v2 Same but with jesse's patch rebased over it.
Created attachment 185176 [details] [review] Port commander to libpeas/gtk3
I managed to make some things more or less work, but the rendering is still not correct.
Review of attachment 185176 [details] [review]: I'd say let's push it and fix the remaining issues in different patches if not it is a pain for review as this is a big monster.