def listClicked_cb(self, widget, event): ''' List clicked @param widget: Widget that activated this callback @param event: Event info ''' sel = widget.get_selection() model, iter = sel.get_selected() if event.button == 3 and iter is not None: message_menu = gtk.Menu() item = gtk.ImageMenuItem(stock_id=gtk.STOCK_DIALOG_INFO) item.connect("activate", self.chatwin.requestUserInfo, gtkutil.getSelectedItem(widget, 0)) message_menu.add(item) message_menu.add( gtk.SeparatorMenuItem() ) item = gtk.ImageMenuItem(stock_id=gtkconstants.STOCK_SEND_IM) item.connect("activate", self.reply_cb, gtkutil.getSelectedItem(widget, 0)) message_menu.add(item) message_menu.add( gtk.SeparatorMenuItem() ) item = gtk.ImageMenuItem(stock_id=gtk.STOCK_DELETE) item.connect("activate", self.delete_cb, gtkutil.getSelectedItem(widget, 3)) message_menu.add(item) message_menu.show_all() message_menu.popup(None, None, None, event.button, event.time)
def listClicked_cb(self, widget, event): ''' List clicked @param widget: Widget that activated this callback @param event: Event info ''' sel = widget.get_selection() model, iter = sel.get_selected() if event.button == 3 and iter is not None: message_menu = gtk.Menu() item = gtk.ImageMenuItem(stock_id=gtk.STOCK_DIALOG_INFO) item.connect("activate", self.chatwin.requestUserInfo, gtkutil.getSelectedItem(widget, 0)) message_menu.add(item) message_menu.add(gtk.SeparatorMenuItem()) item = gtk.ImageMenuItem(stock_id=gtkconstants.STOCK_SEND_IM) item.connect("activate", self.reply_cb, gtkutil.getSelectedItem(widget, 0)) message_menu.add(item) message_menu.add(gtk.SeparatorMenuItem()) item = gtk.ImageMenuItem(stock_id=gtk.STOCK_DELETE) item.connect("activate", self.delete_cb, gtkutil.getSelectedItem(widget, 3)) message_menu.add(item) message_menu.show_all() message_menu.popup(None, None, None, event.button, event.time)
def optionsViewClicked_cb(self, widget, event): ''' Option menu clicked callback. Change the main option section @param widget: Widget that activated this callback @param event: Event information ''' opt = gtkutil.getSelectedItem(widget, 0) if opt is not None and event.button == 1: self.showOptionFrame(opt)
def optionsViewClicked_cb(self, widget, event): ''' Option menu clicked callback. Change the main option section @param widget: Widget that activated this callback @param event: Event information ''' opt = gtkutil.getSelectedItem(widget, 0) if opt is not None and event.button == 1: self.showOptionFrame( opt )
def createNewUser_cb(self, widget, username, password1, password2, dialog): ''' @param widget: @param username: @param password1: @param password2: @param dialog: ''' uname = username.get_text() pw1 = password1.get_text() pw2 = password2.get_text() if len(uname) == 0: self.error(util.ErrorMessage(_("You must enter a username")),dialog) return if len(pw1) == 0: self.error(util.ErrorMessage(_("You must enter a password")),dialog) return if pw1 != pw2: self.error(util.ErrorMessage(_("Passwords do not match")),dialog) return server = gtkutil.getSelectedItem(self.serverView, 0) if server is None: server = self.servers[0][0] for h,g,w,l in self.servers: if h == server: g_port = g w_port = w try: loc = 'http://%s:%s/xmlrpc' % (server,w_port) s = xmlrpclib.ServerProxy(loc) val,msg = s.createNewUser(uname, util.hashPassword(pw1)) except socket.error: self.error(util.ErrorMessage(_('Could not connect to server')),dialog) return if not val: self.error(util.ErrorMessage(lookup.SERVER_MESSAGE_LOOKUP[msg]),dialog) return dialog.destroy() g_loc = '%s:%s' % (server,g_port) self.loginWindow.populateFields_cb(uname, pw1, g_loc) self.destroy()
def reply_cb(self, widget, data=None): ''' Reply callback @param widget: Widget that activated this callback @param data: Data ''' if data is None: data = gtkutil.getSelectedItem(self.view, 0) if data is None: self.error(_('Please select a message')) return self.iconify() self.chatwin.sendPrivateMessage(username=data, data=None)
def getButtons(self): ''' Get action buttons @return: gtk.ButtonBox ''' box = gtk.HButtonBox() b = gtk.Button(_('Reply')) b.connect("clicked", self.reply_cb) box.add(b) b = gtk.Button(_('Delete')) b.connect("clicked", self.delete_cb, gtkutil.getSelectedItem(self.view, 3)) box.add(b) b = gtk.Button(_('Close')) b.connect("clicked", self.close_cb) box.add(b) return box
def delete_cb(self, widget, data=None): ''' Delete callback @param widget: Widget that activated this callback @param data: Data ''' if data is None: data = gtkutil.getSelectedItem(self.view, 3) if data is None: self.error(_('Please select a message')) return model = self.view.get_model().get_model() # TreeViewSort -> ListStore i = model.get_iter_first() while i: num = model.get_value(i, 3) if num == data: model.remove(i) i = None else: i = model.iter_next(i) self.chatwin.deleteMessage(data)