fix some warnings

This commit is contained in:
Yann Leboulanger 2015-07-30 15:18:03 +02:00
parent 5c0fce9668
commit 9287ad96b0
9 changed files with 34 additions and 26 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 B

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 B

After

Width:  |  Height:  |  Size: 156 B

View File

@ -419,10 +419,10 @@ class SocksQueue:
self.connected -= 1 self.connected -= 1
def remove_by_mode(self, sid, mode, do_disconnect=True): def remove_by_mode(self, sid, mode, do_disconnect=True):
for (key, sock) in self.senders.items(): for (key, sock) in self.senders.copy().items():
if key[0] == sid and sock.mode == mode: if key[0] == sid and sock.mode == mode:
self.remove_sender_by_key(key) self.remove_sender_by_key(key)
for (key, sock) in self.readers.items(): for (key, sock) in self.readers.copy().items():
if key[0] == sid and sock.mode == mode: if key[0] == sid and sock.mode == mode:
self.remove_receiver_by_key(key) self.remove_receiver_by_key(key)

View File

@ -954,22 +954,24 @@ class PreferencesWindow:
col = gajim.config.get(c) col = gajim.config.get(c)
if col: if col:
if isinstance(col_to_widget[c], list): if isinstance(col_to_widget[c], list):
self.xml.get_object(col_to_widget[c][0]).set_color( rgba = Gdk.RGBA()
Gdk.color_parse(col)) rgba.parse(col)
self.xml.get_object(col_to_widget[c][0]).set_rgba(rgba)
self.xml.get_object(col_to_widget[c][0]).set_sensitive(True) self.xml.get_object(col_to_widget[c][0]).set_sensitive(True)
self.xml.get_object(col_to_widget[c][1]).set_active(True) self.xml.get_object(col_to_widget[c][1]).set_active(True)
else: else:
self.xml.get_object(col_to_widget[c]).set_color( rgba = Gdk.RGBA()
Gdk.color_parse(col)) rgba.parse(col)
self.xml.get_object(col_to_widget[c]).set_rgba(rgba)
else: else:
rgba = Gdk.RGBA()
rgba.parse('#000000')
if isinstance(col_to_widget[c], list): if isinstance(col_to_widget[c], list):
self.xml.get_object(col_to_widget[c][0]).set_color( self.xml.get_object(col_to_widget[c][0]).set_rgba(rgba)
Gdk.color_parse('#000000'))
self.xml.get_object(col_to_widget[c][0]).set_sensitive(False) self.xml.get_object(col_to_widget[c][0]).set_sensitive(False)
self.xml.get_object(col_to_widget[c][1]).set_active(False) self.xml.get_object(col_to_widget[c][1]).set_active(False)
else: else:
self.xml.get_object(col_to_widget[c]).set_color( self.xml.get_object(col_to_widget[c]).set_rgba(rgba)
Gdk.color_parse('#000000'))
def on_reset_colors_button_clicked(self, widget): def on_reset_colors_button_clicked(self, widget):
col_to_widget = {'inmsgcolor': 'incoming_nick_colorbutton', col_to_widget = {'inmsgcolor': 'incoming_nick_colorbutton',

View File

@ -421,7 +421,8 @@ class SingleForm(Gtk.Table, object):
# 5 option max: show checkbutton # 5 option max: show checkbutton
widget = Gtk.VBox() widget = Gtk.VBox()
for value, label in field.iter_options(): for value, label in field.iter_options():
check = Gtk.CheckButton(label, use_underline=False) check = Gtk.CheckButton(label=label,
use_underline=False)
check.set_active(value in field.values) check.set_active(value in field.values)
check.connect('toggled', check.connect('toggled',
self.on_list_multi_checkbutton_toggled, field, value) self.on_list_multi_checkbutton_toggled, field, value)

View File

@ -1663,7 +1663,7 @@ class YesNoDialog(HigDialog):
on_response_no=self.on_response_no) on_response_no=self.on_response_no)
if checktext: if checktext:
self.checkbutton = Gtk.CheckButton(checktext) self.checkbutton = Gtk.CheckButton(label=checktext)
self.vbox.pack_start(self.checkbutton, False, True, 0) self.vbox.pack_start(self.checkbutton, False, True, 0)
else: else:
self.checkbutton = None self.checkbutton = None
@ -1756,7 +1756,7 @@ class ConfirmationDialogCheck(ConfirmationDialog):
ok_button = self.action_area.get_children()[0] # right to left ok_button = self.action_area.get_children()[0] # right to left
ok_button.grab_focus() ok_button.grab_focus()
self.checkbutton = Gtk.CheckButton(checktext) self.checkbutton = Gtk.CheckButton(label=checktext)
self.vbox.pack_start(self.checkbutton, False, True, 0) self.vbox.pack_start(self.checkbutton, False, True, 0)
self.set_modal(is_modal) self.set_modal(is_modal)
self.popup() self.popup()
@ -1812,14 +1812,14 @@ class ConfirmationDialogDoubleCheck(ConfirmationDialog):
ok_button.grab_focus() ok_button.grab_focus()
if checktext1: if checktext1:
self.checkbutton1 = Gtk.CheckButton(checktext1) self.checkbutton1 = Gtk.CheckButton(label=checktext1)
if tooltip1: if tooltip1:
self.checkbutton1.set_tooltip_text(tooltip1) self.checkbutton1.set_tooltip_text(tooltip1)
self.vbox.pack_start(self.checkbutton1, False, True, 0) self.vbox.pack_start(self.checkbutton1, False, True, 0)
else: else:
self.checkbutton1 = None self.checkbutton1 = None
if checktext2: if checktext2:
self.checkbutton2 = Gtk.CheckButton(checktext2) self.checkbutton2 = Gtk.CheckButton(label=checktext2)
if tooltip2: if tooltip2:
self.checkbutton2.set_tooltip_text(tooltip2) self.checkbutton2.set_tooltip_text(tooltip2)
self.vbox.pack_start(self.checkbutton2, False, True, 0) self.vbox.pack_start(self.checkbutton2, False, True, 0)
@ -1969,7 +1969,7 @@ class FTOverwriteConfirmationDialog(ConfirmationDialog):
self.on_response = on_response self.on_response = on_response
if propose_resume: if propose_resume:
b = Gtk.Button('', Gtk.STOCK_REFRESH) b = Gtk.Button(label='', stock=Gtk.STOCK_REFRESH)
align = b.get_children()[0] align = b.get_children()[0]
hbox = align.get_children()[0] hbox = align.get_children()[0]
label = hbox.get_children()[1] label = hbox.get_children()[1]
@ -1977,7 +1977,7 @@ class FTOverwriteConfirmationDialog(ConfirmationDialog):
label.set_use_underline(True) label.set_use_underline(True)
self.add_action_widget(b, 100) self.add_action_widget(b, 100)
b = Gtk.Button('', Gtk.STOCK_SAVE_AS) b = Gtk.Button(label='', stock=Gtk.STOCK_SAVE_AS)
align = b.get_children()[0] align = b.get_children()[0]
hbox = align.get_children()[0] hbox = align.get_children()[0]
label = hbox.get_children()[1] label = hbox.get_children()[1]
@ -2086,7 +2086,7 @@ class InputDialogCheck(InputDialog):
self.input_entry.select_region(0, -1) # select all self.input_entry.select_region(0, -1) # select all
if checktext: if checktext:
self.checkbutton = Gtk.CheckButton(checktext) self.checkbutton = Gtk.CheckButton(label=checktext)
self.vbox.pack_start(self.checkbutton, False, True, 0) self.vbox.pack_start(self.checkbutton, False, True, 0)
self.checkbutton.show() self.checkbutton.show()

View File

@ -199,7 +199,9 @@ class GajimThemesWindow:
textcolor = gajim.config.get_per('themes', theme, option + 'textcolor') textcolor = gajim.config.get_per('themes', theme, option + 'textcolor')
if textcolor: if textcolor:
state = True state = True
self.text_colorbutton.set_color(Gdk.color_parse(textcolor)) rgba = Gdk.RGBA()
rgba.parse(textcolor)
self.text_colorbutton.set_rgba(rgba)
else: else:
state = False state = False
self.textcolor_checkbutton.set_active(state) self.textcolor_checkbutton.set_active(state)
@ -207,8 +209,9 @@ class GajimThemesWindow:
bgcolor = gajim.config.get_per('themes', theme, option + 'bgcolor') bgcolor = gajim.config.get_per('themes', theme, option + 'bgcolor')
if bgcolor: if bgcolor:
state = True state = True
self.background_colorbutton.set_color(Gdk.color_parse( rgba = Gdk.RGBA()
bgcolor)) rgba.parse(bgcolor)
self.background_colorbutton.set_rgba(rgba)
else: else:
state = False state = False
self.background_checkbutton.set_active(state) self.background_checkbutton.set_active(state)
@ -232,7 +235,9 @@ class GajimThemesWindow:
'muc_msg', 'muc_directed_msg'): 'muc_msg', 'muc_directed_msg'):
color = gajim.config.get_per('themes', theme, 'state_' + chatstate + \ color = gajim.config.get_per('themes', theme, 'state_' + chatstate + \
'_color') '_color')
self.colorbuttons[chatstate].set_color(Gdk.color_parse(color)) rgba = Gdk.RGBA()
rgba.parse(color)
self.colorbuttons[chatstate].set_rgba(rgba)
def on_textcolor_checkbutton_toggled(self, widget): def on_textcolor_checkbutton_toggled(self, widget):
state = widget.get_active() state = widget.get_active()

View File

@ -31,7 +31,7 @@ import pickle
secrets_filename = gajimpaths['SECRETS_FILE'] secrets_filename = gajimpaths['SECRETS_FILE']
secrets_cache = None secrets_cache = None
class Secrets: class Secrets():
def __init__(self, filename): def __init__(self, filename):
self.filename = filename self.filename = filename
self.srs = {} self.srs = {}
@ -43,7 +43,7 @@ class Secrets:
def save(self): def save(self):
f = open(secrets_filename, 'wb') f = open(secrets_filename, 'wb')
pickle.dump(self, f) pickle.dump(self, f, protocol=2)
f.close() f.close()
def retained_secrets(self, account, bare_jid): def retained_secrets(self, account, bare_jid):

View File

@ -197,7 +197,7 @@ class VcardWindow:
def set_value(self, entry_name, value): def set_value(self, entry_name, value):
try: try:
if value and entry_name == 'URL_label': if value and entry_name == 'URL_label':
widget = Gtk.LinkButton(value, value) widget = Gtk.LinkButton(uri=value, label=value)
widget.set_alignment(0, 0) widget.set_alignment(0, 0)
widget.show() widget.show()
table = self.xml.get_object('personal_info_table') table = self.xml.get_object('personal_info_table')
@ -555,7 +555,7 @@ class ZeroconfVcardWindow:
def set_value(self, entry_name, value): def set_value(self, entry_name, value):
try: try:
if value and entry_name == 'URL_label': if value and entry_name == 'URL_label':
widget = Gtk.LinkButton(value, value) widget = Gtk.LinkButton(uri=value, label=value)
widget.set_alignment(0, 0) widget.set_alignment(0, 0)
table = self.xml.get_object('personal_info_table') table = self.xml.get_object('personal_info_table')
table.attach(widget, 1, 4, 3, 4, yoptions = 0) table.attach(widget, 1, 4, 3, 4, yoptions = 0)