improve code quality
This commit is contained in:
parent
3e7627aa6d
commit
357c85a2ad
|
@ -139,13 +139,13 @@ def escape_for_pango_markup(string):
|
|||
if gtk.pygtk_version >= (2, 8, 0) and gtk.gtk_version >= (2, 8, 0):
|
||||
escaped_str = gobject.markup_escape_text(string)
|
||||
else:
|
||||
escaped_str =xml.sax.saxutils.escape(string, {"'": ''',
|
||||
escaped_str = xml.sax.saxutils.escape(string, {"'": ''',
|
||||
'"': '"'})
|
||||
|
||||
return escaped_str
|
||||
|
||||
def autodetect_browser_mailer():
|
||||
#recognize the environment for appropriate browser/mailer
|
||||
# recognize the environment for appropriate browser/mailer
|
||||
if os.path.isdir('/proc'):
|
||||
# under Linux: checking if 'gnome-session' or
|
||||
# 'startkde' programs were run before gajim, by
|
||||
|
@ -210,14 +210,14 @@ class TagInfoHandler(xml.sax.ContentHandler):
|
|||
for attribute in attributes.getNames():
|
||||
if attribute == 'jid':
|
||||
jid = attributes.getValue(attribute)
|
||||
#We will get the port next time so we just set it 0 here
|
||||
# we will get the port next time so we just set it 0 here
|
||||
self.servers.append([jid, 0])
|
||||
elif name == self.tagname2:
|
||||
for attribute in attributes.getNames():
|
||||
if attribute == 'port':
|
||||
port = attributes.getValue(attribute)
|
||||
#We received the jid last time, so we now assign the port
|
||||
#number to the last jid in the list
|
||||
# we received the jid last time, so we now assign the port
|
||||
# number to the last jid in the list
|
||||
self.servers[-1][1] = port
|
||||
|
||||
def endElement(self, name):
|
||||
|
@ -230,10 +230,10 @@ def parse_server_xml(path_to_file):
|
|||
return handler.servers
|
||||
# handle exception if unable to open file
|
||||
except IOError, message:
|
||||
print "Error reading file:", message
|
||||
print >> sys.stderr, _('Error reading file:'), message
|
||||
# handle exception parsing file
|
||||
except xml.sax.SAXParseException, message:
|
||||
print "Error parsing file:", message
|
||||
print >> sys.stderr, _('Error parsing file:'), message
|
||||
|
||||
def set_unset_urgency_hint(window, unread_messages_no):
|
||||
'''sets/unsets urgency hint in window argument
|
||||
|
@ -285,7 +285,7 @@ def get_abspath_for_script(scriptname, want_type = False):
|
|||
return path_to_script
|
||||
|
||||
def get_pixbuf_from_data(file_data):
|
||||
'''wants img data and returns gtk pixbuf'''
|
||||
'''wants img data and returns gtk.gdk.Pixbuf'''
|
||||
pixbufloader = gtk.gdk.PixbufLoader()
|
||||
try:
|
||||
pixbufloader.write(file_data)
|
||||
|
|
|
@ -32,8 +32,8 @@ gtk.glade.textdomain(APP)
|
|||
GTKGUI_GLADE = 'gtkgui.glade'
|
||||
|
||||
class HistoryWindow:
|
||||
"""Class for bowser agent window:
|
||||
to know the agents on the selected server"""
|
||||
'''Class for bowser agent window:
|
||||
to know the agents on the selected server'''
|
||||
def on_history_window_destroy(self, widget):
|
||||
del self.plugin.windows['logs'][self.jid]
|
||||
|
||||
|
@ -119,7 +119,7 @@ class HistoryWindow:
|
|||
self.latest_button.set_sensitive(False)
|
||||
|
||||
def new_line(self, date, type, data):
|
||||
"""write a new line"""
|
||||
'''write a new line'''
|
||||
buff = self.history_buffer
|
||||
start_iter = buff.get_start_iter()
|
||||
tim = time.strftime('[%x %X] ', time.localtime(float(date)))
|
||||
|
|
Loading…
Reference in New Issue