def add_new_label(self, instance): button_parent = self.info_panel button_parent.remove_widget(self.info_panel.button_layout) self.info_panel.button_layout.clear_widgets() attr_layout = RelativeLayout(size=(100, 30), size_hint=(1, None)) edit_label = EditableLabel(text="", size=(300, 30), size_hint=(None, None), pos_hint={ "center_x": .5, "center_y": .5 }, color=(1, 1, 1, 1), font_size=14) attr_layout.add_widget(edit_label) button_parent.add_widget(attr_layout) edit_label.toggle_edit(edit_label) self.info_panel.button_layout.add_widget( HoverButton(font_size=20, text='New Attribute', size=(500, 30), size_hint=(None, None), pos_hint={"center_x": .5}, button_up=DD_LCHRC[0], button_down=DD_LCHRC[1], on_press=self.add_new_label)) self.info_panel.add_widget(self.info_panel.button_layout)
def add_new_label(self, group=False): for child in self.layout.children: if type(child) == EditableLabel: if child.text == '': self.layout.remove_widget(child) else: pass if manager.CURRENT_USER != None or manager.CURRENT_GROUP != None: attr_layout = RelativeLayout(size=(100, 30), size_hint=(1, None)) edit_label = EditableLabel(text=(''), pos_hint={ "center_x": .5, "center_y": .5 }, size_hint=(None, None), size=(300, 30), group=group, color=(1, 1, 1, 1), font_size=14) edit_label.name = None edit_label.val = None self.attribute_labels.append(edit_label) attr_layout.add_widget(edit_label) self.layout.add_widget(attr_layout) edit_label.toggle_edit(edit_label)
def create_attr_label(self, attr, editable, group=False): attr_layout = RelativeLayout(size=(100, 30), size_hint=(1, None)) color = (1, 1, 1, 1) bold = manager.menu.get_search_mode( ) != 'name' and manager.menu.get_search_term() != "" if self.color_dark(attr.name, attr.value): color = (1, 1, 1, .6) bold = False label = EditableLabel(text=("" + attr.name + " " + attr.operator + " " + attr.value), attr_category=attr.category, color=color, size=(300, 30), group=group, bold=bold, editable=editable, size_hint=(None, None), pos_hint={ "center_x": .5, "center_y": .5 }, font_size=14) label.name = attr.name label.val = attr.value attr_layout.add_widget(label) self.attribute_labels.append(label) self.layout.add_widget(attr_layout)
def __init__(self, terminal): """Class initialiser""" GObject.GObject.__init__(self) self.terminator = Terminator() self.terminal = terminal self.config = self.terminal.config self.label = EditableLabel() self.label.connect('edit-done', self.on_edit_done) self.ebox = Gtk.EventBox() grouphbox = Gtk.HBox() self.grouplabel = Gtk.Label(ellipsize='end') self.groupicon = Gtk.Image() self.bellicon = Gtk.Image() self.bellicon.set_no_show_all(True) self.groupentry = Gtk.Entry() self.groupentry.set_no_show_all(True) self.groupentry.connect('focus-out-event', self.groupentry_cancel) self.groupentry.connect('activate', self.groupentry_activate) self.groupentry.connect('key-press-event', self.groupentry_keypress) groupsend_type = self.terminator.groupsend_type if self.terminator.groupsend == groupsend_type['all']: icon_name = 'all' elif self.terminator.groupsend == groupsend_type['group']: icon_name = 'group' elif self.terminator.groupsend == groupsend_type['off']: icon_name = 'off' self.set_from_icon_name('_active_broadcast_%s' % icon_name, Gtk.IconSize.MENU) grouphbox.pack_start(self.groupicon, False, True, 2) grouphbox.pack_start(self.grouplabel, False, True, 2) grouphbox.pack_start(self.groupentry, False, True, 2) self.ebox.add(grouphbox) self.ebox.show_all() self.bellicon.set_from_icon_name('terminal-bell', Gtk.IconSize.MENU) viewport = Gtk.Viewport(hscroll_policy='natural') viewport.add(self.label) hbox = Gtk.HBox() hbox.pack_start(self.ebox, False, True, 0) hbox.pack_start(Gtk.VSeparator(), False, True, 0) hbox.pack_start(viewport, True, True, 0) hbox.pack_end(self.bellicon, False, False, 2) self.add(hbox) hbox.show_all() self.set_no_show_all(True) self.show() self.connect('button-press-event', self.on_clicked)
def __init__(self, terminal): """Class initialiser""" gtk.EventBox.__init__(self) self.__gobject_init__() self.terminator = Terminator() self.terminal = terminal self.config = self.terminal.config self.label = EditableLabel() self.label.connect('edit-done', self.on_edit_done) self.ebox = gtk.EventBox() grouphbox = gtk.HBox() self.grouplabel = gtk.Label() self.groupicon = gtk.Image() self.bellicon = gtk.Image() self.bellicon.set_no_show_all(True) self.groupentry = gtk.Entry() self.groupentry.set_no_show_all(True) self.groupentry.connect('focus-out-event', self.groupentry_cancel) self.groupentry.connect('activate', self.groupentry_activate) self.groupentry.connect('key-press-event', self.groupentry_keypress) groupsend_type = self.terminator.groupsend_type if self.terminator.groupsend == groupsend_type['all']: icon_name = 'all' elif self.terminator.groupsend == groupsend_type['group']: icon_name = 'group' elif self.terminator.groupsend == groupsend_type['off']: icon_name = 'off' self.set_from_icon_name('_active_broadcast_%s' % icon_name, gtk.ICON_SIZE_MENU) grouphbox.pack_start(self.groupicon, False, True, 2) grouphbox.pack_start(self.grouplabel, False, True, 2) grouphbox.pack_start(self.groupentry, False, True, 2) self.ebox.add(grouphbox) self.ebox.show_all() self.bellicon.set_from_icon_name('terminal-bell', gtk.ICON_SIZE_MENU) hbox = gtk.HBox() hbox.pack_start(self.ebox, False, True, 0) hbox.pack_start(gtk.VSeparator(), False, True, 0) hbox.pack_start(self.label, True, True) hbox.pack_end(self.bellicon, False, False, 2) self.add(hbox) hbox.show_all() self.set_no_show_all(True) self.show() self.connect('button-press-event', self.on_clicked)
def __init__(self, title, notebook): gtk.HBox.__init__(self) self.notebook = notebook self.config = Config() self.terminal = None self.label = EditableLabel(title) self.update_angle() self.broadcast_image = None self.prefix_box = gtk.HBox() self.pack_start(self.prefix_box, False, False) self.pack_start(self.label, True, True) self.update_button() self.connect('button-press-event', self.show_popupmenu) self.show_all()
def __init__(self, title, notebook): """Class initialiser""" GObject.GObject.__init__(self) self.notebook = notebook self.terminator = Terminator() self.config = Config() self.label = EditableLabel(title) self.update_angle() self.pack_start(self.label, True, True, 0) self.update_button() self.show_all()
def display_preset_info(self, preset): self.info_panel.clear_widgets() if preset == None: return manager.CURRENT_PRESET = preset.name self.show_presets() self.info_panel.add_widget( Label(text=(preset.name), color=(1, 1, 1, 1), font_size=25)) for key in preset.attributes: attr_layout = RelativeLayout(size=(100, 30), size_hint=(1, None)) attr_layout.add_widget( EditableLabel(text=('' + key[0] + ' ' + key[1] + ' ' + preset.attributes[key]), size=(300, 30), attr_category=key[2], size_hint=(None, None), pos_hint={ "center_x": .5, "center_y": .5 }, color=(1, 1, 1, 1), font_size=14)) self.info_panel.add_widget(attr_layout) self.info_panel.button_layout = RelativeLayout(size=(100, 30), size_hint=(1, None)) self.info_panel.button_layout.add_widget( HoverButton(font_size=20, text='New Attribute', size=(500, 30), size_hint=(None, None), pos_hint={"center_x": .5}, button_up=DD_LCHRC[0], button_down=DD_LCHRC[1], on_press=self.add_new_label)) self.info_panel.add_widget(self.info_panel.button_layout)
def __init__(self, title, notebook): """Class initialiser""" GObject.GObject.__init__(self) self.notebook = notebook self.terminator = Terminator() self.config = Config() self.label = EditableLabel(title) self.label.add_events(2097152) # SCROLL self.label.add_events(4194304) # TOUCH self.label.connect('scroll-event', notebook.on_scroll_event) self.update_angle() self.pack_start(self.label, True, True, 0) self.update_button() if self.button: self.button.add_events(2097152) # SCROLL self.button.add_events(4194304) # TOUCH self.button.connect('scroll-event', notebook.on_scroll_event) self.show_all()