def __init__(self, mainwin, label=''): gtk.VBox.__init__(self, False) self.mainwin = mainwin self.statuslist = StatusList(mainwin) self.waiting = CairoWaiting(mainwin) self.walign = gtk.Alignment(xalign=1, yalign=0.5) self.walign.add(self.waiting) self.errorbox = ErrorBox() self.label = gtk.Label(label) self.caption = label self.connect('expose-event', self.error_show)
def __init__(self, mainwin, label='', menu='normal'): gtk.VBox.__init__(self, False) self.last = None # Last tweets updated self.mainwin = mainwin self.list = gtk.TreeView() self.list.set_headers_visible(False) self.list.set_events(gtk.gdk.POINTER_MOTION_MASK) self.list.set_level_indentation(0) self.list.set_rules_hint(True) self.list.set_resize_mode(gtk.RESIZE_IMMEDIATE) self.label = gtk.Label(label) self.caption = label self.lblerror = gtk.Label() self.lblerror.set_use_markup(True) self.waiting = CairoWaiting(mainwin) align = gtk.Alignment(xalign=1, yalign=0.5) align.add(self.waiting) bottombox = gtk.HBox(False) bottombox.pack_start(self.lblerror, False, False, 2) bottombox.pack_start(align, True, True, 2) scroll = gtk.ScrolledWindow() scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) scroll.set_shadow_type(gtk.SHADOW_IN) scroll.add(self.list) self.model = gtk.ListStore( gtk.gdk.Pixbuf, # avatar str, #username str, #datetime str, #client str, #pango_message str, #real_message str, # id bool, #favorited? gobject.TYPE_PYOBJECT, # in_reply_to_id gobject.TYPE_PYOBJECT, # in_reply_to_user gobject.TYPE_PYOBJECT, # retweeted_by gtk.gdk.Color, #gobject.TYPE_PYOBJECT, #color ) self.list.set_model(self.model) cell_avatar = gtk.CellRendererPixbuf() cell_avatar.set_property('yalign', 0) self.cell_tweet = gtk.CellRendererText() self.cell_tweet.set_property('wrap-mode', pango.WRAP_WORD) self.cell_tweet.set_property('wrap-width', 260) self.cell_tweet.set_property('yalign', 0) self.cell_tweet.set_property('xalign', 0) column = gtk.TreeViewColumn('tweets') column.set_alignment(0.0) column.pack_start(cell_avatar, False) column.pack_start(self.cell_tweet, True) column.set_attributes(self.cell_tweet, markup=4, cell_background_gdk=11) column.set_attributes(cell_avatar, pixbuf=0) self.list.append_column(column) if menu == 'normal': self.list.connect("button-release-event", self.__popup_menu) elif menu == 'direct': self.list.connect("button-release-event", self.__direct_popup_menu) self.pack_start(scroll, True, True) self.pack_start(bottombox, False, False)
def __init__(self, parent): gtk.Window.__init__(self) self.mainwin = parent self.set_title(_('Secure Authentication')) ### self.set_default_size(800, 450) self.set_transient_for(parent) self.set_position(gtk.WIN_POS_CENTER_ON_PARENT) self.connect('delete-event', self.quit) self.settings = webkit.WebSettings() self.settings.enable_java_applet = False #self.settings.enable_plugins = False self.settings.enable_page_cache = True self.settings.enable_offline_web_application_cache = False self.settings.enable_html5_local_storage = False self.settings.enable_html5_database = False self.settings.enable_default_context_menu = False self.view = webkit.WebView() self.view.set_settings(self.settings) self.view.connect('load-started', self.__started) self.view.connect('load-finished', self.__finished) scroll = gtk.ScrolledWindow() scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) scroll.set_shadow_type(gtk.SHADOW_IN) scroll.add(self.view) self.label = gtk.Label() self.label.set_use_markup(True) self.label.set_alignment(0, 0) self.label.set_markup( _('Autorize Turpial, copy the <b>PIN</b> in the \ text box below and click OK:')) self.waiting_label = gtk.Label() self.waiting_label.set_use_markup(True) self.waiting = CairoWaiting(parent) waiting_box = gtk.Alignment(xalign=1.0) waiting_box.add(self.waiting_label) lblbox = gtk.HBox(False, 2) lblbox.pack_start(self.label, True, True, 2) lblbox.pack_start(waiting_box, True, True, 2) lblbox.pack_start(self.waiting, False, False, 2) self.pin = gtk.Entry() cancel = gtk.Button(stock=gtk.STOCK_CANCEL) accept = gtk.Button(stock=gtk.STOCK_OK) hbox = gtk.HBox(False, 0) hbox.pack_start(self.pin, True, True, 2) hbox.pack_start(cancel, False, False, 2) hbox.pack_start(accept, False, False, 2) vbox = gtk.VBox(False, 5) vbox.pack_start(scroll, True, True, 0) vbox.pack_start(lblbox, False, False, 2) vbox.pack_start(hbox, False, False, 2) cancel.connect('clicked', self.quit) accept.connect('clicked', self.__accept) self.add(vbox)
def __init__(self, mainwin, label='', profile=None): gtk.VBox.__init__(self, False) label_width = 75 self.mainwin = mainwin self.user = None self.label = gtk.Label(label) self.caption = label self.user_pic = gtk.Button() self.user_pic.set_size_request(60, 60) pic_box = gtk.VBox(False) pic_box.pack_start(self.user_pic, False, False, 10) self.screen_name = gtk.Label() self.screen_name.set_alignment(0, 0.5) self.tweets_count = gtk.Label() self.tweets_count.set_alignment(0, 0.5) self.tweets_count.set_padding(8, 0) self.following_count = gtk.Label() self.following_count.set_alignment(0, 0.5) self.following_count.set_padding(8, 0) self.followers_count = gtk.Label() self.followers_count.set_alignment(0, 0.5) self.followers_count.set_padding(8, 0) info_box = gtk.VBox(False) info_box.pack_start(self.screen_name, False, False, 5) info_box.pack_start(self.tweets_count, False, False) info_box.pack_start(self.following_count, False, False) info_box.pack_start(self.followers_count, False, False) top = gtk.HBox(False) top.pack_start(pic_box, False, False, 10) top.pack_start(info_box, False, False, 5) self.real_name = gtk.Entry() self.real_name.set_max_length(20) name_lbl = gtk.Label(_('Name')) name_lbl.set_size_request(label_width, -1) name_box = gtk.HBox(False) name_box.pack_start(name_lbl, False, False, 2) name_box.pack_start(self.real_name, True, True, 5) self.location = gtk.Entry() self.location.set_max_length(30) loc_lbl = gtk.Label(_('Location')) loc_lbl.set_size_request(label_width, -1) loc_box = gtk.HBox(False) loc_box.pack_start(loc_lbl, False, False, 2) loc_box.pack_start(self.location, True, True, 5) self.url = gtk.Entry() self.url.set_max_length(100) url_lbl = gtk.Label(_('URL')) url_lbl.set_size_request(label_width, -1) url_box = gtk.HBox(False) url_box.pack_start(url_lbl, False, False, 2) url_box.pack_start(self.url, True, True, 5) self.bio = gtk.TextView() self.bio.set_wrap_mode(gtk.WRAP_WORD) scrollwin = gtk.ScrolledWindow() scrollwin.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER) scrollwin.set_shadow_type(gtk.SHADOW_IN) scrollwin.set_size_request(-1, 80) scrollwin.add(self.bio) bio_lbl = gtk.Label(_('Bio')) bio_lbl.set_size_request(label_width, -1) bio_box = gtk.HBox(False) bio_box.pack_start(bio_lbl, False, False, 2) bio_box.pack_start(scrollwin, True, True, 5) form = gtk.VBox(False) form.pack_start(name_box, False, False, 4) form.pack_start(loc_box, False, False, 4) form.pack_start(url_box, False, False, 4) form.pack_start(bio_box, False, False, 4) self.submit = gtk.Button(_('Save')) submit_box = gtk.Alignment(1.0, 0.5) submit_box.set_property('right-padding', 5) submit_box.add(self.submit) self.lblerror = gtk.Label() self.lblerror.set_use_markup(True) self.waiting = CairoWaiting(mainwin) self.lblerror.set_markup("Hola mundo") self.waiting.stop(True) align = gtk.Alignment(xalign=1, yalign=0.5) align.add(self.waiting) bottombox = gtk.HBox(False) bottombox.pack_start(self.lblerror, False, False, 2) bottombox.pack_start(align, True, True, 2) spacebox = gtk.VBox(False) self.pack_start(top, False, False) self.pack_start(form, False, False) self.pack_start(submit_box, False, False) self.pack_start(spacebox, True, True) self.pack_start(bottombox, False, False) self.submit.connect('clicked', self.save_user_profile)
def __init__(self, parent): gtk.Window.__init__(self) self.filename = '' self.pic_url = '' self.blocked = False self.mainwin = parent #self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG) self.set_title(_('Upload picture')) self.set_resizable(False) self.set_size_request(300, 400) self.set_transient_for(parent) #self.set_modal(True) self.set_position(gtk.WIN_POS_CENTER_ON_PARENT) #self.btn_pic = gtk.Button(_('Click to select image')) self.btn_pic = gtk.Button() self.btn_pic.set_size_request(250, 250) pic_box = gtk.VBox(False) pic_box.pack_start(self.btn_pic, True, True, 0) self.label = gtk.Label() self.label.set_use_markup(True) self.label.set_alignment(0, 0.5) self.label.set_markup('<span size="medium"><b>%s</b></span>' % _('Message')) self.label.set_justify(gtk.JUSTIFY_LEFT) self.num_chars = gtk.Label() self.num_chars.set_use_markup(True) self.num_chars.set_markup( '<span size="14000" foreground="#999"><b>140</b></span>') self.update_text = MessageTextView() self.update_text.set_border_width(2) self.update_text.set_left_margin(2) self.update_text.set_right_margin(2) self.update_text.set_wrap_mode(gtk.WRAP_WORD) buffer = self.update_text.get_buffer() scroll = gtk.ScrolledWindow() scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) scroll.set_shadow_type(gtk.SHADOW_IN) scroll.add(self.update_text) updatebox = gtk.HBox(False) updatebox.pack_start(scroll, True, True, 3) self.btn_clr = gtk.Button() self.btn_clr.set_image(self.mainwin.load_image('action-clear.png')) self.btn_clr.set_tooltip_text(_('Clear all') + ' (Ctrl+L)') self.btn_clr.set_relief(gtk.RELIEF_NONE) self.btn_frn = gtk.Button() self.btn_frn.set_image( self.mainwin.load_image('action-add-friends.png')) self.btn_frn.set_tooltip_text(_('Add friends') + ' (Ctrl+F)') self.btn_frn.set_relief(gtk.RELIEF_NONE) self.btn_upd = gtk.Button(_('Upload')) self.btn_upd.set_tooltip_text(_('Update your status') + ' (Ctrl+T)') top = gtk.HBox(False) top.pack_start(self.label, True, True, 5) top.pack_start(self.num_chars, False, False, 5) self.waiting = CairoWaiting(parent) self.lblerror = gtk.Label() self.lblerror.set_use_markup(True) error_align = gtk.Alignment(xalign=0.0) error_align.add(self.lblerror) buttonbox = gtk.HBox(False) buttonbox.pack_start(self.btn_frn, False, False, 0) buttonbox.pack_start(self.btn_clr, False, False, 0) buttonbox.pack_start(gtk.HSeparator(), False, False, 2) buttonbox.pack_start(self.btn_upd, False, False, 0) abuttonbox = gtk.Alignment(1, 0.5) abuttonbox.add(buttonbox) bottom = gtk.HBox(False) bottom.pack_start(self.waiting, False, False, 5) bottom.pack_start(error_align, True, True, 4) #bottom.pack_start(abuttonbox, True, True, 5) vbox = gtk.VBox(False) vbox.pack_start(pic_box, False, False, 2) vbox.pack_start(top, False, False, 2) vbox.pack_start(updatebox, True, True, 2) vbox.pack_start(abuttonbox, False, False, 2) vbox.pack_start(bottom, False, False, 2) self.add(vbox) self.connect('key-press-event', self.__detect_shortcut) self.connect('delete-event', self.__unclose) buffer.connect('changed', self.count_chars) self.btn_frn.connect('clicked', self.show_friend_dialog) self.btn_clr.connect('clicked', self.clear) self.btn_upd.connect('clicked', self.upload) self.btn_pic.connect('clicked', self.choose_pic) self.update_text.connect('mykeypress', self.__on_key_pressed) if SPELLING: try: self.spell = gtkspell.Spell(self.update_text) except Exception, e_msg: # FIXME: Usar el log print 'DEBUG:UI:Can\'t load gtkspell -> %s' % e_msg
def show_login(self, global_config): self.mode = 1 if self.vbox is not None: self.remove(self.vbox) avatar = self.load_image('logo2.png') self.message = LoginLabel(self) lbl_user = gtk.Label() #lbl_user.set_justify(gtk.JUSTIFY_LEFT) lbl_user.set_use_markup(True) lbl_user.set_markup(u'<span size="small">%s</span>' % _('User and Password')) lbl_user.set_alignment(0, 0.5) self.username = gtk.Entry() self.password = gtk.Entry() self.password.set_visibility(False) self.remember = gtk.CheckButton(_('Remember my credentials')) self.btn_oauth = gtk.Button(_('Connect')) self.btn_settings = gtk.Button() self.btn_settings.set_relief(gtk.RELIEF_NONE) self.btn_settings.set_tooltip_text(_('Preferences')) self.btn_settings.set_image(self.load_image('settings-single.png')) settings_box = gtk.Alignment(xalign=1.0, yalign=0.5) settings_box.set_padding(70, 10, 40, 40) settings_box.add(self.btn_settings) self.waiting = CairoWaiting(self) align = gtk.Alignment(xalign=1, yalign=0.5) align.add(self.waiting) hbox = gtk.HBox(False) hbox.pack_start(lbl_user, False, False, 2) hbox.pack_start(align, True, True, 2) table = gtk.Table(10, 1, False) table.attach(avatar, 0, 1, 0, 1, gtk.FILL, gtk.FILL, 10, 50) table.attach(self.message, 0, 1, 1, 2, gtk.EXPAND | gtk.FILL, gtk.FILL, 20, 3) table.attach(hbox, 0, 1, 2, 3, gtk.EXPAND | gtk.FILL, gtk.FILL, 50, 0) table.attach(self.username, 0, 1, 3, 4, gtk.EXPAND | gtk.FILL, gtk.FILL, 50, 0) table.attach(self.password, 0, 1, 5, 6, gtk.EXPAND | gtk.FILL, gtk.FILL, 50, 0) table.attach(self.btn_oauth, 0, 1, 7, 8, gtk.EXPAND, gtk.FILL, 0, 10) table.attach(self.remember, 0, 1, 8, 9, gtk.EXPAND, gtk.FILL, 0, 10) table.attach(settings_box, 0, 1, 9, 10, gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL, 0, 10) self.vbox = gtk.VBox(False, 5) self.vbox.pack_start(table, False, False, 2) self.add(self.vbox) self.show_all() self.btn_oauth.connect('clicked', self.oauth) self.password.connect('activate', self.oauth) self.remember.connect("toggled", self.__toogle_remember) self.btn_settings.connect('clicked', self.show_preferences, 'global') username = global_config.read('Login', 'username') password = global_config.read('Login', 'password') if username != '' and password != '': self.username.set_text(username) self.password.set_text(base64.b64decode(password)) self.remember.set_active(True)
def __init__(self, mainwin): gtk.VBox.__init__(self, False, 5) self.mainwin = mainwin avatar = self.mainwin.load_image('logo2.png') self.message = LoginLabel(self) us, pw, rem, auto = self.mainwin.request_remembered(0) lbl_user = gtk.Label() lbl_user.set_use_markup(True) lbl_user.set_markup(u'<span size="small">%s</span>' % _('User and Password')) lbl_user.set_alignment(0, 0.5) self.username = gtk.Entry() self.username.set_text(us) self.password = gtk.Entry() self.password.set_visibility(False) self.password.set_text(pw) self.remember = gtk.CheckButton(_('Remember my credentials')) self.autologin = gtk.CheckButton(_('Automatic login')) self.autologin.set_sensitive(False) self.btn_oauth = gtk.Button(_('Connect')) list = gtk.ListStore(gtk.gdk.Pixbuf, str, str) for p in PROTOCOLS: image = '%s.png' % p t_icon = self.mainwin.load_image(image, True) list.append([t_icon, p, p]) self.combo_protocol = gtk.ComboBox(list) icon_cell = gtk.CellRendererPixbuf() txt_cell = gtk.CellRendererText() self.combo_protocol.pack_start(icon_cell, False) self.combo_protocol.pack_start(txt_cell, False) self.combo_protocol.add_attribute(icon_cell, 'pixbuf', 0) self.combo_protocol.add_attribute(txt_cell, 'markup', 1) self.combo_protocol.set_active(0) self.btn_settings = gtk.Button() self.btn_settings.set_relief(gtk.RELIEF_NONE) self.btn_settings.set_tooltip_text(_('Preferences')) self.btn_settings.set_image( self.mainwin.load_image('dock-settings.png')) settings_box = gtk.Alignment(xalign=1.0, yalign=0.5) settings_box.add(self.btn_settings) self.waiting = CairoWaiting(self.mainwin) align = gtk.Alignment(xalign=1, yalign=0.5) align.add(self.waiting) hbox = gtk.HBox(False) hbox.pack_start(lbl_user, False, False, 2) hbox.pack_start(align, True, True, 2) table = gtk.Table(11, 1, False) table.attach(settings_box, 0, 1, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL, 0, 3) table.attach(avatar, 0, 1, 1, 2, gtk.FILL, gtk.FILL, 10, 50) table.attach(self.message, 0, 1, 2, 3, gtk.EXPAND | gtk.FILL, gtk.FILL, 20, 3) table.attach(hbox, 0, 1, 3, 4, gtk.EXPAND | gtk.FILL, gtk.FILL, 50, 0) table.attach(self.username, 0, 1, 4, 5, gtk.EXPAND | gtk.FILL, gtk.FILL, 50, 0) table.attach(self.password, 0, 1, 6, 7, gtk.EXPAND | gtk.FILL, gtk.FILL, 50, 0) table.attach(self.combo_protocol, 0, 1, 8, 9, gtk.EXPAND, gtk.FILL, 0, 10) table.attach(self.btn_oauth, 0, 1, 9, 10, gtk.EXPAND, gtk.FILL, 0, 3) table.attach(self.remember, 0, 1, 10, 11, gtk.FILL, gtk.FILL, 60, 1) table.attach(self.autologin, 0, 1, 11, 12, gtk.FILL, gtk.FILL, 60, 1) self.pack_start(table, False, False, 2) self.btn_oauth.grab_focus() self.btn_oauth.connect('clicked', self.signin) self.password.connect('activate', self.signin) self.rhandler = self.remember.connect("toggled", self.__toogle_remember) self.btn_settings.connect('clicked', self.mainwin.show_preferences, 'global') self.combo_protocol.connect('changed', self.__change_protocol) self.autologin.connect('toggled', self.__remember) self.remember.set_active(rem) self.autologin.set_active(auto) if rem: self.btn_oauth.grab_focus() else: self.username.grab_focus() if auto: self.signin(None)
def __init__(self, parent): gtk.Window.__init__(self) self.what = _('What is happening?') self.blocked = False self.mainwin = parent #self.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG) self.set_title(_('Update status')) self.set_resizable(False) #self.set_default_size(500, 120) self.set_size_request(500, 150) self.set_transient_for(parent) self.set_position(gtk.WIN_POS_CENTER_ON_PARENT) self.label = gtk.Label() self.label.set_use_markup(True) self.label.set_alignment(0, 0.5) self.label.set_markup('<span size="medium"><b>%s</b></span>' % self.what) self.label.set_justify(gtk.JUSTIFY_LEFT) self.num_chars = gtk.Label() self.num_chars.set_use_markup(True) self.num_chars.set_markup( '<span size="14000" foreground="#999"><b>140</b></span>') self.update_text = MessageTextView() self.update_text.set_border_width(2) self.update_text.set_left_margin(2) self.update_text.set_right_margin(2) self.update_text.set_wrap_mode(gtk.WRAP_WORD) buffer = self.update_text.get_buffer() scroll = gtk.ScrolledWindow() scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) scroll.set_shadow_type(gtk.SHADOW_IN) scroll.add(self.update_text) updatebox = gtk.HBox(False) updatebox.pack_start(scroll, True, True, 3) self.url = gtk.Entry() self.btn_url = gtk.Button(_('Shorten URL')) self.btn_url.set_tooltip_text(_('Shorten URL')) self.btn_pic = gtk.Button(_('Upload image')) self.btn_pic.set_tooltip_text(_('Upload image')) tools = gtk.HBox(False) tools.pack_start(self.url, True, True, 3) tools.pack_start(self.btn_url, False, False) tools.pack_start(gtk.HSeparator(), False, False) tools.pack_start(self.btn_pic, False, False, 3) self.toolbox = gtk.Expander() self.toolbox.set_label(_('Options')) self.toolbox.set_expanded(False) self.toolbox.add(tools) self.btn_clr = gtk.Button() self.btn_clr.set_image(self.mainwin.load_image('clear.png')) self.btn_clr.set_tooltip_text(_('Clear all')) self.btn_clr.set_relief(gtk.RELIEF_NONE) self.btn_frn = gtk.Button() self.btn_frn.set_image(self.mainwin.load_image('friends.png')) self.btn_frn.set_tooltip_text(_('Add friends')) self.btn_frn.set_relief(gtk.RELIEF_NONE) self.btn_upd = gtk.Button(_('Tweet')) chk_short = gtk.CheckButton(_('Autoshort URLs')) chk_short.set_sensitive(False) top = gtk.HBox(False) top.pack_start(self.label, True, True, 5) top.pack_start(self.num_chars, False, False, 5) self.waiting = CairoWaiting(parent) self.lblerror = gtk.Label() self.lblerror.set_use_markup(True) error_align = gtk.Alignment(xalign=0.0) error_align.add(self.lblerror) buttonbox = gtk.HBox(False) buttonbox.pack_start(chk_short, False, False, 0) buttonbox.pack_start(self.btn_frn, False, False, 0) buttonbox.pack_start(self.btn_clr, False, False, 0) buttonbox.pack_start(gtk.HSeparator(), False, False, 2) buttonbox.pack_start(self.btn_upd, False, False, 0) abuttonbox = gtk.Alignment(1, 0.5) abuttonbox.add(buttonbox) bottom = gtk.HBox(False) bottom.pack_start(self.waiting, False, False, 5) bottom.pack_start(error_align, True, True, 4) bottom.pack_start(abuttonbox, True, True, 5) vbox = gtk.VBox(False) vbox.pack_start(top, False, False, 2) vbox.pack_start(updatebox, True, True, 2) vbox.pack_start(bottom, False, False, 2) vbox.pack_start(self.toolbox, False, False, 2) self.add(vbox) self.connect('delete-event', self.__unclose) buffer.connect('changed', self.count_chars) self.btn_frn.connect('clicked', self.show_friend_dialog) self.btn_clr.connect('clicked', self.clear) self.btn_upd.connect('clicked', self.update) self.btn_url.connect('clicked', self.short_url) self.btn_pic.connect('clicked', self.upload_pic) self.toolbox.connect('activate', self.show_options) self.update_text.connect('mykeypress', self.__on_key_pressed) if SPELLING: try: self.spell = gtkspell.Spell(self.update_text) except Exception, e_msg: # FIXME: Usar el log print 'DEBUG:UI:Can\'t load gtkspell -> %s' % e_msg