Remove new() in dialogs.py

This commit is contained in:
Romain Failliot 2022-04-04 14:18:25 -04:00
parent a0225ff5ff
commit 5eca7db14b
1 changed files with 19 additions and 14 deletions

View File

@ -78,9 +78,8 @@ class FileChooserDialog(Gtk.FileChooserDialog):
self.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL) self.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
self.add_button(accept, Gtk.ResponseType.OK) self.add_button(accept, Gtk.ResponseType.OK)
self.prefs = prefs self.prefs = prefs
hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0, border_width=5)
hbox.set_border_width(5) label = Gtk.Label(label=_('Encoding: '))
label = Gtk.Label.new(_('Encoding: '))
hbox.pack_start(label, False, False, 0) hbox.pack_start(label, False, False, 0)
label.show() label.show()
self.encoding = entry = utils.EncodingMenu( self.encoding = entry = utils.EncodingMenu(
@ -89,10 +88,10 @@ class FileChooserDialog(Gtk.FileChooserDialog):
hbox.pack_start(entry, False, False, 5) hbox.pack_start(entry, False, False, 5)
entry.show() entry.show()
if rev: if rev:
self.revision = entry = Gtk.Entry.new() self.revision = entry = Gtk.Entry()
hbox.pack_end(entry, False, False, 0) hbox.pack_end(entry, False, False, 0)
entry.show() entry.show()
label = Gtk.Label.new(_('Revision: ')) label = Gtk.Label(label=_('Revision: '))
hbox.pack_end(label, False, False, 0) hbox.pack_end(label, False, False, 0)
label.show() label.show()
@ -122,15 +121,21 @@ class NumericDialog(Gtk.Dialog):
self.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT) self.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT)
self.add_button(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT) self.add_button(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)
vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
vbox.set_border_width(10) vbox.set_border_width(10)
hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0)
label = Gtk.Label.new(text) label = Gtk.Label(label=text)
hbox.pack_start(label, False, False, 0) hbox.pack_start(label, False, False, 0)
label.show() label.show()
adj = Gtk.Adjustment.new(val, lower, upper, step, page, 0) adj = Gtk.Adjustment(
self.button = button = Gtk.SpinButton.new(adj, 1.0, 0) value=val,
lower=lower,
upper=upper,
step_increment=step,
page_increment=page,
page_size=0)
self.button = button = Gtk.SpinButton(adjustment=adj, climb_rate=1.0, digits=0)
button.connect('activate', self.button_cb) button.connect('activate', self.button_cb)
hbox.pack_start(button, True, True, 0) hbox.pack_start(button, True, True, 0)
button.show() button.show()
@ -152,11 +157,11 @@ class SearchDialog(Gtk.Dialog):
self.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT) self.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT)
self.add_button(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT) self.add_button(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)
vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
vbox.set_border_width(10) vbox.set_border_width(10)
hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0) hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0)
label = Gtk.Label.new(_('Search For: ')) label = Gtk.Label(label=_('Search For: '))
hbox.pack_start(label, False, False, 0) hbox.pack_start(label, False, False, 0)
label.show() label.show()
combo = Gtk.ComboBoxText.new_with_entry() combo = Gtk.ComboBoxText.new_with_entry()
@ -167,7 +172,7 @@ class SearchDialog(Gtk.Dialog):
self.entry.set_text(pattern) self.entry.set_text(pattern)
if history is not None: if history is not None:
completion = Gtk.EntryCompletion.new() completion = Gtk.EntryCompletion()
liststore = Gtk.ListStore(GObject.TYPE_STRING) liststore = Gtk.ListStore(GObject.TYPE_STRING)
completion.set_model(liststore) completion.set_model(liststore)
completion.set_text_column(0) completion.set_text_column(0)