def addClicked(self, button, controller): self.hide() def _on_ce_choosed(response, path, shortcut, size): '''method called when the ce is selected''' if response != stock.ACCEPT: return self.config.user['emoticonDir']= os.path.dirname(path) if size == dialog.CEChooser.SMALL: size = 0 else: size = 1 ret,msg = self.customEmoticons.create(shortcut, path, size) if not ret: dialog.error(msg) #Let's create the list of customs emoticons for dialog.CEChooser. \ # _on_changed #Arielj: -why is this method getting config from controller? there's a self.config attribute # -I've add a self.controller attribute to call this method when add is clicked # -we shouldn't need to pass a controller as a parameter with that new attribute # -CustomEmoticons should receive only the controller and get the from that controller inside. config = controller.config ce = CustomEmoticons.CustomEmoticons(config, controller) smilie_list = ce.loadMap() dialog.set_custom_emoticon(self.config.user['emoticonDir'], _on_ce_choosed, smilie_list)
def addClicked(self, button): self.hide() def _on_ce_choosed(response, path, shortcut, size): '''method called when the ce is selected''' if response != stock.ACCEPT: return self.config.user['emoticonDir']= os.path.dirname(path) if size == dialog.CEChooser.SMALL: size = 0 else: size = 1 ret,msg = self.customEmoticons.create(shortcut, path, size) if not ret: dialog.error(msg) dialog.set_custom_emoticon(self.config.user['emoticonDir'], _on_ce_choosed)