示例#1
0
    def __init__(self, mainwin, label='', pos=None, viewed=None):
        GenericColumn.__init__(self, mainwin, label)

        self.pos = pos
        self.handler = None
        #self.changing_col = False

        model = gtk.ListStore(str, str)
        cell = gtk.CellRendererText()
        self.listcombo = gtk.ComboBox()
        self.listcombo.pack_start(cell, True)
        self.listcombo.add_attribute(cell, 'text', 1)
        self.listcombo.set_model(model)

        self.refresh = SpinnerButton(mainwin, 'action-refresh.png')
        self.refresh.set_tooltip_text(_('Manual Update'))

        self.mark_all = gtk.Button()
        self.mark_all.set_image(self.mainwin.load_image('action-mark-all.png'))
        self.mark_all.set_tooltip_text(_('Mark all as read'))

        listsbox = gtk.HBox(False)
        listsbox.pack_start(self.mark_all, False, False)
        listsbox.pack_start(self.listcombo, True, True)
        listsbox.pack_start(self.refresh, False, False)

        self.pack_start(listsbox, False, False)
        self.pack_start(self.errorbox, False, False)
        self.pack_start(self.statuslist, True, True)

        self.refresh.connect('clicked', self.__manual_update)
        self.mark_all.connect('clicked', self.__mark_all_as_read)
示例#2
0
    def __init__(self, mainwin, label=''):
        GenericColumn.__init__(self, mainwin, label)

        self.input_topics = gtk.Entry()
        self.clearbtn = SpinnerButton(mainwin, 'action-clear.png')
        self.clearbtn.set_tooltip_text(_('Clear results'))
        try:
            #self.input_topics.set_property("primary-icon-stock",
            #                               gtk.STOCK_FIND)
            self.input_topics.set_property("secondary-icon-stock",
                                           gtk.STOCK_FIND)
            self.input_topics.connect("icon-press", self.__on_icon_press)
        except:
            pass

        inputbox = gtk.HBox(False)
        inputbox.pack_start(self.input_topics, True, True)
        inputbox.pack_start(self.clearbtn, False, False)

        self.pack_start(inputbox, False, False)
        self.pack_start(self.errorbox, False, False)
        self.pack_start(self.statuslist, True, True)

        self.clearbtn.connect('clicked', self.__clear)
        self.input_topics.connect('activate', self.__search_topic)
        self.input_topics.grab_focus()
示例#3
0
 def __init__(self, mainwin, label='', pos=None, viewed=None):
     GenericColumn.__init__(self, mainwin, label)
     
     self.pos = pos
     self.handler = None
     #self.changing_col = False
     
     model = gtk.ListStore(str, str)
     cell = gtk.CellRendererText()
     self.listcombo = gtk.ComboBox()
     self.listcombo.pack_start(cell, True)
     self.listcombo.add_attribute(cell, 'text', 1)
     self.listcombo.set_model(model)
     
     self.refresh = SpinnerButton(mainwin, 'action-refresh.png')
     self.refresh.set_tooltip_text(_('Manual Update'))
     
     self.mark_all = gtk.Button()
     self.mark_all.set_image(self.mainwin.load_image('action-mark-all.png'))
     self.mark_all.set_tooltip_text(_('Mark all as read'))
     
     listsbox = gtk.HBox(False)
     listsbox.pack_start(self.mark_all, False, False)
     listsbox.pack_start(self.listcombo, True, True)
     listsbox.pack_start(self.refresh, False, False)
     
     self.pack_start(listsbox, False, False)
     self.pack_start(self.errorbox, False, False)
     self.pack_start(self.statuslist, True, True)
     
     self.refresh.connect('clicked', self.__manual_update)
     self.mark_all.connect('clicked', self.__mark_all_as_read)
示例#4
0
 def __init__(self, mainwin, label=''):
     GenericColumn.__init__(self, mainwin, label)
     
     self.input_topics = gtk.Entry()
     self.clearbtn = SpinnerButton(mainwin, 'action-clear.png')
     self.clearbtn.set_tooltip_text(_('Clear results'))
     try:
         #self.input_topics.set_property("primary-icon-stock", 
         #                               gtk.STOCK_FIND)
         self.input_topics.set_property("secondary-icon-stock",
                                        gtk.STOCK_FIND)
         self.input_topics.connect("icon-press", self.__on_icon_press)
     except: 
         pass
     
     inputbox = gtk.HBox(False)
     inputbox.pack_start(self.input_topics, True, True)
     inputbox.pack_start(self.clearbtn, False, False)
     
     self.pack_start(inputbox, False, False)
     self.pack_start(self.errorbox, False, False)
     self.pack_start(self.statuslist, True, True)
     
     self.clearbtn.connect('clicked', self.__clear)
     self.input_topics.connect('activate', self.__search_topic)
     self.input_topics.grab_focus()
示例#5
0
class StandardColumn(GenericColumn):
    def __init__(self, mainwin, label='', pos=None, viewed=None):
        GenericColumn.__init__(self, mainwin, label)
        
        self.pos = pos
        self.handler = None
        #self.changing_col = False
        
        model = gtk.ListStore(str, str)
        cell = gtk.CellRendererText()
        self.listcombo = gtk.ComboBox()
        self.listcombo.pack_start(cell, True)
        self.listcombo.add_attribute(cell, 'text', 1)
        self.listcombo.set_model(model)
        
        self.refresh = SpinnerButton(mainwin, 'action-refresh.png')
        self.refresh.set_tooltip_text(_('Manual Update'))
        
        self.mark_all = gtk.Button()
        self.mark_all.set_image(self.mainwin.load_image('action-mark-all.png'))
        self.mark_all.set_tooltip_text(_('Mark all as read'))
        
        listsbox = gtk.HBox(False)
        listsbox.pack_start(self.mark_all, False, False)
        listsbox.pack_start(self.listcombo, True, True)
        listsbox.pack_start(self.refresh, False, False)
        
        self.pack_start(listsbox, False, False)
        self.pack_start(self.errorbox, False, False)
        self.pack_start(self.statuslist, True, True)
        
        self.refresh.connect('clicked', self.__manual_update)
        self.mark_all.connect('clicked', self.__mark_all_as_read)
        
    def __manual_update(self, widget):
        self.mainwin.manual_update(self.pos)
        
    def __mark_all_as_read(self, widget):
        self.statuslist.mark_all_as_read()
        
    def __change_list(self, widget):
        model = self.listcombo.get_model()
        iter = self.listcombo.get_active_iter()
        new_id = model.get_value(iter, 0)
        self.caption = model.get_value(iter, 1)
        self.label.set_label(self.caption)
        try:
            self.get_parent().set_tab_label(self, self.label)
        except:
            pass
        self.mainwin.request_change_column(self.pos, new_id)
        
    def fill_combo(self, columns, new_viewed):
        self.viewed = new_viewed[self.pos]
        
        i = 0
        default = -1
        model = self.listcombo.get_model()
        fixed = ['timeline', 'replies', 'directs','sent']
        for key in fixed:
            model.append([key, columns[key].title])
            if key == self.viewed.id:
                default = i
            i += 1
            
        for key in sorted(columns.iterkeys()):
            if key in fixed:
                continue
            model.append([key, columns[key].title])
            if key == self.viewed.id:
                default = i
            i += 1
        
        self.last_index = default
        self.listcombo.set_model(model)
        self.listcombo.set_active(self.last_index)
        iter = self.listcombo.get_active_iter()
        self.caption = model.get_value(iter, 1)
        self.label = gtk.Label(self.caption)
        self.handler = self.listcombo.connect('changed', self.__change_list)
        
    def set_combo_item(self, reset=False):
        self.listcombo.disconnect(self.handler)
        if reset:
            self.listcombo.set_active(self.last_index)
        else:
            self.last_index = self.listcombo.get_active()
            
        self.handler = self.listcombo.connect('changed', self.__change_list)
        
    def get_combo_item(self):
        model = self.listcombo.get_model()
        iter = self.listcombo.get_active_iter()
        return model.get_value(iter, 0)
        
    def start_update(self):
        self.errorbox.hide()
        self.refresh.spin()
        self.listcombo.set_sensitive(False)
        self.mark_all.set_sensitive(False)
        
    def stop_update(self, error=False, msg=''):
        if error:
            self.set_combo_item(True)
        else:
            self.set_combo_item()
        self.errorbox.show_error(msg, error)
        self.refresh.stop()
        self.listcombo.set_sensitive(True)
        self.mark_all.set_sensitive(True)
    
    def update_wrap(self, width):
        self.statuslist.update_wrap(width)
示例#6
0
class SearchColumn(GenericColumn):
    def __init__(self, mainwin, label=''):
        GenericColumn.__init__(self, mainwin, label)
        
        self.input_topics = gtk.Entry()
        self.clearbtn = SpinnerButton(mainwin, 'action-clear.png')
        self.clearbtn.set_tooltip_text(_('Clear results'))
        try:
            #self.input_topics.set_property("primary-icon-stock", 
            #                               gtk.STOCK_FIND)
            self.input_topics.set_property("secondary-icon-stock",
                                           gtk.STOCK_FIND)
            self.input_topics.connect("icon-press", self.__on_icon_press)
        except: 
            pass
        
        inputbox = gtk.HBox(False)
        inputbox.pack_start(self.input_topics, True, True)
        inputbox.pack_start(self.clearbtn, False, False)
        
        self.pack_start(inputbox, False, False)
        self.pack_start(self.errorbox, False, False)
        self.pack_start(self.statuslist, True, True)
        
        self.clearbtn.connect('clicked', self.__clear)
        self.input_topics.connect('activate', self.__search_topic)
        self.input_topics.grab_focus()
        
    def __on_icon_press(self, widget, pos, e):
        #if pos == 0: 
        #    self.__search_topic(widget)
        if pos == 1:
            #widget.set_text('')
            self.__search_topic(widget)
            
    def __clear(self, widget):
        self.statuslist.clear()
        self.input_topics.grab_focus()
        
    def __search_topic(self, widget):
        topic = widget.get_text()
        if topic != '':
            self.lock()
            self.mainwin.request_search(topic)
            widget.set_text('')
        else:
            widget.set_text(_('You must write something to search'))
            widget.grab_focus()
        
    def on_update(self, data=None):
        self.unlock()
        
    def lock(self):
        self.input_topics.set_sensitive(False)
        self.clearbtn.set_sensitive(False)
        
    def unlock(self):
        self.input_topics.set_sensitive(True)
        self.clearbtn.set_sensitive(True)
        
    def start_update(self):
        self.clearbtn.spin()
        self.errorbox.hide()
        
    def stop_update(self, error=False, msg=''):
        self.clearbtn.stop()
        self.errorbox.show_error(msg, error)
示例#7
0
class StandardColumn(GenericColumn):
    def __init__(self, mainwin, label='', pos=None, viewed=None):
        GenericColumn.__init__(self, mainwin, label)

        self.pos = pos
        self.handler = None
        #self.changing_col = False

        model = gtk.ListStore(str, str)
        cell = gtk.CellRendererText()
        self.listcombo = gtk.ComboBox()
        self.listcombo.pack_start(cell, True)
        self.listcombo.add_attribute(cell, 'text', 1)
        self.listcombo.set_model(model)

        self.refresh = SpinnerButton(mainwin, 'action-refresh.png')
        self.refresh.set_tooltip_text(_('Manual Update'))

        self.mark_all = gtk.Button()
        self.mark_all.set_image(self.mainwin.load_image('action-mark-all.png'))
        self.mark_all.set_tooltip_text(_('Mark all as read'))

        listsbox = gtk.HBox(False)
        listsbox.pack_start(self.mark_all, False, False)
        listsbox.pack_start(self.listcombo, True, True)
        listsbox.pack_start(self.refresh, False, False)

        self.pack_start(listsbox, False, False)
        self.pack_start(self.errorbox, False, False)
        self.pack_start(self.statuslist, True, True)

        self.refresh.connect('clicked', self.__manual_update)
        self.mark_all.connect('clicked', self.__mark_all_as_read)

    def __manual_update(self, widget):
        self.mainwin.manual_update(self.pos)

    def __mark_all_as_read(self, widget):
        self.statuslist.mark_all_as_read()

    def __change_list(self, widget):
        model = self.listcombo.get_model()
        iter = self.listcombo.get_active_iter()
        new_id = model.get_value(iter, 0)
        self.caption = model.get_value(iter, 1)
        self.label.set_label(self.caption)
        try:
            self.get_parent().set_tab_label(self, self.label)
        except:
            pass
        self.mainwin.request_change_column(self.pos, new_id)

    def fill_combo(self, columns, new_viewed):
        self.viewed = new_viewed[self.pos]

        i = 0
        default = -1
        model = self.listcombo.get_model()
        fixed = ['timeline', 'replies', 'directs', 'sent']
        for key in fixed:
            model.append([key, columns[key].title])
            if key == self.viewed.id:
                default = i
            i += 1

        for key in sorted(columns.iterkeys()):
            if key in fixed:
                continue
            model.append([key, columns[key].title])
            if key == self.viewed.id:
                default = i
            i += 1

        self.last_index = default
        self.listcombo.set_model(model)
        self.listcombo.set_active(self.last_index)
        iter = self.listcombo.get_active_iter()
        self.caption = model.get_value(iter, 1)
        self.label = gtk.Label(self.caption)
        self.handler = self.listcombo.connect('changed', self.__change_list)

    def set_combo_item(self, reset=False):
        self.listcombo.disconnect(self.handler)
        if reset:
            self.listcombo.set_active(self.last_index)
        else:
            self.last_index = self.listcombo.get_active()

        self.handler = self.listcombo.connect('changed', self.__change_list)

    def get_combo_item(self):
        model = self.listcombo.get_model()
        iter = self.listcombo.get_active_iter()
        return model.get_value(iter, 0)

    def start_update(self):
        self.errorbox.hide()
        self.refresh.spin()
        self.listcombo.set_sensitive(False)
        self.mark_all.set_sensitive(False)

    def stop_update(self, error=False, msg=''):
        if error:
            self.set_combo_item(True)
        else:
            self.set_combo_item()
        self.errorbox.show_error(msg, error)
        self.refresh.stop()
        self.listcombo.set_sensitive(True)
        self.mark_all.set_sensitive(True)

    def update_wrap(self, width):
        self.statuslist.update_wrap(width)
示例#8
0
class SearchColumn(GenericColumn):
    def __init__(self, mainwin, label=''):
        GenericColumn.__init__(self, mainwin, label)

        self.input_topics = gtk.Entry()
        self.clearbtn = SpinnerButton(mainwin, 'action-clear.png')
        self.clearbtn.set_tooltip_text(_('Clear results'))
        try:
            #self.input_topics.set_property("primary-icon-stock",
            #                               gtk.STOCK_FIND)
            self.input_topics.set_property("secondary-icon-stock",
                                           gtk.STOCK_FIND)
            self.input_topics.connect("icon-press", self.__on_icon_press)
        except:
            pass

        inputbox = gtk.HBox(False)
        inputbox.pack_start(self.input_topics, True, True)
        inputbox.pack_start(self.clearbtn, False, False)

        self.pack_start(inputbox, False, False)
        self.pack_start(self.errorbox, False, False)
        self.pack_start(self.statuslist, True, True)

        self.clearbtn.connect('clicked', self.__clear)
        self.input_topics.connect('activate', self.__search_topic)
        self.input_topics.grab_focus()

    def __on_icon_press(self, widget, pos, e):
        #if pos == 0:
        #    self.__search_topic(widget)
        if pos == 1:
            #widget.set_text('')
            self.__search_topic(widget)

    def __clear(self, widget):
        self.statuslist.clear()
        self.input_topics.grab_focus()

    def __search_topic(self, widget):
        topic = widget.get_text()
        if topic != '':
            self.lock()
            self.mainwin.request_search(topic)
            widget.set_text('')
        else:
            widget.set_text(_('You must write something to search'))
            widget.grab_focus()

    def on_update(self, data=None):
        self.unlock()

    def lock(self):
        self.input_topics.set_sensitive(False)
        self.clearbtn.set_sensitive(False)

    def unlock(self):
        self.input_topics.set_sensitive(True)
        self.clearbtn.set_sensitive(True)

    def start_update(self):
        self.clearbtn.spin()
        self.errorbox.hide()

    def stop_update(self, error=False, msg=''):
        self.clearbtn.stop()
        self.errorbox.show_error(msg, error)