Skip to content

Commit 5eca7db

Browse files
committed
Remove new() in dialogs.py
1 parent a0225ff commit 5eca7db

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

src/diffuse/dialogs.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,8 @@ def __init__(self, title, parent, prefs, action, accept, rev=False):
7878
self.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL)
7979
self.add_button(accept, Gtk.ResponseType.OK)
8080
self.prefs = prefs
81-
hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
82-
hbox.set_border_width(5)
83-
label = Gtk.Label.new(_('Encoding: '))
81+
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0, border_width=5)
82+
label = Gtk.Label(label=_('Encoding: '))
8483
hbox.pack_start(label, False, False, 0)
8584
label.show()
8685
self.encoding = entry = utils.EncodingMenu(
@@ -89,10 +88,10 @@ def __init__(self, title, parent, prefs, action, accept, rev=False):
8988
hbox.pack_start(entry, False, False, 5)
9089
entry.show()
9190
if rev:
92-
self.revision = entry = Gtk.Entry.new()
91+
self.revision = entry = Gtk.Entry()
9392
hbox.pack_end(entry, False, False, 0)
9493
entry.show()
95-
label = Gtk.Label.new(_('Revision: '))
94+
label = Gtk.Label(label=_('Revision: '))
9695
hbox.pack_end(label, False, False, 0)
9796
label.show()
9897

@@ -122,15 +121,21 @@ def __init__(self, parent, title, text, val, lower, upper, step=1, page=0):
122121
self.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT)
123122
self.add_button(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)
124123

125-
vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
124+
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
126125
vbox.set_border_width(10)
127126

128-
hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
129-
label = Gtk.Label.new(text)
127+
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0)
128+
label = Gtk.Label(label=text)
130129
hbox.pack_start(label, False, False, 0)
131130
label.show()
132-
adj = Gtk.Adjustment.new(val, lower, upper, step, page, 0)
133-
self.button = button = Gtk.SpinButton.new(adj, 1.0, 0)
131+
adj = Gtk.Adjustment(
132+
value=val,
133+
lower=lower,
134+
upper=upper,
135+
step_increment=step,
136+
page_increment=page,
137+
page_size=0)
138+
self.button = button = Gtk.SpinButton(adjustment=adj, climb_rate=1.0, digits=0)
134139
button.connect('activate', self.button_cb)
135140
hbox.pack_start(button, True, True, 0)
136141
button.show()
@@ -152,11 +157,11 @@ def __init__(self, parent, pattern=None, history=None):
152157
self.add_button(Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT)
153158
self.add_button(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)
154159

155-
vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
160+
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
156161
vbox.set_border_width(10)
157162

158-
hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
159-
label = Gtk.Label.new(_('Search For: '))
163+
hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0)
164+
label = Gtk.Label(label=_('Search For: '))
160165
hbox.pack_start(label, False, False, 0)
161166
label.show()
162167
combo = Gtk.ComboBoxText.new_with_entry()
@@ -167,7 +172,7 @@ def __init__(self, parent, pattern=None, history=None):
167172
self.entry.set_text(pattern)
168173

169174
if history is not None:
170-
completion = Gtk.EntryCompletion.new()
175+
completion = Gtk.EntryCompletion()
171176
liststore = Gtk.ListStore(GObject.TYPE_STRING)
172177
completion.set_model(liststore)
173178
completion.set_text_column(0)

0 commit comments

Comments
 (0)