Allow to add separator

Until now, all the menu entries were shown in a continuous list, one
after another. This patch allows to add separators between entries.
This commit is contained in:
Sergio Costas 2019-01-03 23:18:59 +01:00
parent 8719778d22
commit c222c4ab14
8 changed files with 616 additions and 214 deletions

48
src/devedeng/separator.py Normal file
View file

@ -0,0 +1,48 @@
# Copyright 2019 (C) Raster Software Vigo (Sergio Costas)
#
# This file is part of DeVeDe-NG
#
# DeVeDe-NG is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# DeVeDe-NG is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
from gi.repository import Gtk, GObject
import os
import devedeng.configuration_data
import devedeng.interface_manager
class separator(devedeng.interface_manager.interface_manager):
__gsignals__ = {'name_changed': (GObject.SIGNAL_RUN_FIRST, None, (str,)), 'in_menu_changed': (
GObject.SIGNAL_RUN_FIRST, None, (bool,))}
def __init__(self):
self.element_type = "separator"
devedeng.interface_manager.interface_manager.__init__(self)
self.add_toggle("show_in_menu", True)
self.add_text("separator_name", _("Separator"))
def set_name(self, new_name):
self.separator_name = new_name
self.emit('name_changed', self.separator_name)
def delete_element(self):
return
def store_element(self):
data = self.serialize()
data["element_type"] = "separator"
return data
def restore_element(self, data):
self.unserialize(data)