Exemplo n.º 1
0
    def __init__(self):
        self.entries = ObjectList([Column("title", width=120),
                                   Column("period", width=80),
                                   Column("text", expand=True)])

        ProxyDelegate.__init__(self, DiaryEntry(), ['title', 'period', 'text'],
                               gladefile="diary",
                               delete_handler=self.quit_if_last)
        self.hbox.pack_start(self.entries)
        self.entries.show()
        self.entries.grab_focus()
Exemplo n.º 2
0
 def __init__(self):
     self.entries = ObjectList([Column("title", width=120, sorted=True),
                                Column("period", width=80),
                                Column("text", expand=True, visible=False)])
     ProxyDelegate.__init__(self, DiaryEntry(),
                            ['title', 'period', 'text', 'chars', 'words'],
                            gladefile="diary2.ui",
                            delete_handler=self.quit_if_last)
     self.hbox.pack_start(self.entries, True, True, 0)
     self.entries.show()
     self.entries.grab_focus()
     self.set_editable(False)
Exemplo n.º 3
0
 def __init__(self, toplevel=None):
     ProxyDelegate.__init__(
         self,
         model=None,
         toplevel=toplevel,
         delete_handler=self.hide,
         gladefile="editor",
         widgets=("name", "address", "phones", "add_phone", "edit_phone",
                  "remove_phone", "birthday", "category", "cancel", "ok"),
         proxy_widgets=("name", "address", "birthday"))
     self.phones.set_columns(
         [Column("number", title="Number", editable=True, expand=True)])
Exemplo n.º 4
0
    def __init__(self, list_updater, edit=None):
        self.__edit = edit
        self.__parent_populate_list = list_updater

        if edit is None:
            self.__tmp = TempModel()
        else:
            self.__tmp = TempModel(edit.name, edit.description, edit.value,
                                   edit.vulns, edit.owner)

        proxy_widgets = [
            'invent_name', 'invent_value', 'invent_description', 'invent_owner'
        ]
        ProxyDelegate.__init__(self,
                               self.__tmp,
                               proxy_widgets,
                               'ui',
                               toplevel_name='InventoryAddWindow',
                               delete_handler=self.dialog_delete)

        # Arvore de vulnerabilidades
        cols = [
            Column('description',
                   title=_('Description'),
                   data_type=unicode,
                   expand=True),
            Column('state',
                   title=_('Applicable?'),
                   data_type=bool,
                   editable=True)
        ]

        self.tree = self.get_widget('invent_vuln_list')
        self.tree.set_columns(cols)
        self.owner_field = self.get_widget('invent_owner')

        all_owners = [x.name for x in Owner.query().all()]
        all_vulns = Vulnerability.query().all()

        self.owner_field.prefill(all_owners, True)

        if self.__edit is not None:
            edit = self.__edit
            for item in all_vulns:
                if item in edit.vulns:
                    vuln_to_add = vuln(item.description, True, id=item.id)
                else:
                    vuln_to_add = vuln(item.description, id=item.id)
                self.tree.append(vuln_to_add)
        else:
            for item in all_vulns:
                vuln_to_add = vuln(item.description, id=item.id)
                self.tree.append(vuln_to_add)
Exemplo n.º 5
0
 def __init__(self):
     self.entries = ObjectList([Column("title", width=120, sorted=True),
                                Column("period", width=80),
                                Column("text", expand=True, visible=False)])
     ProxyDelegate.__init__(self, DiaryEntry(),
                            ['title', 'period', 'text', 'chars', 'words'],
                            gladefile="diary2.ui",
                            delete_handler=self.quit_if_last)
     self.hbox.pack_start(self.entries)
     self.entries.show()
     self.entries.grab_focus()
     self.set_editable(False)
Exemplo n.º 6
0
 def __init__(self, model=None):
     ProxyDelegate.__init__(self,
                            model,
                            gladefile="form",
                            delete_handler=quit_if_last,
                            widgets=("text_entry", "int_entry",
                                     "float_entry", "date_entry",
                                     "mandatory_entry", "ok"),
                            proxy_widgets=("text_entry", "int_entry",
                                           "float_entry", "date_entry",
                                           "mandatory_entry"))
     self.register_validate_function(self.validity)
     self.force_validation()
Exemplo n.º 7
0
    def __init__(self):
        self.entries = ObjectList([
            Column("title", width=120),
            Column("period", width=80),
            Column("text", expand=True)
        ])

        ProxyDelegate.__init__(self,
                               DiaryEntry(), ['title', 'period', 'text'],
                               gladefile="diary.ui",
                               delete_handler=self.quit_if_last)
        self.hbox.pack_start(self.entries, True, True, 0)
        self.entries.show()
        self.entries.grab_focus()
Exemplo n.º 8
0
 def __init__(self, model=None):
     ProxyDelegate.__init__(self, model,
                             gladefile="form",
                             delete_handler=quit_if_last,
                             widgets=("text_entry",
                                       "int_entry",
                                       "float_entry",
                                       "date_entry",
                                       "mandatory_entry",
                                       "ok"),
                             proxy_widgets=("text_entry",
                                             "int_entry",
                                             "float_entry",
                                             "date_entry",
                                             "mandatory_entry"))
     self.register_validate_function(self.validity)
     self.force_validation()
Exemplo n.º 9
0
    def __init__(self, list_updater, edit = None):
        self.__edit = edit  
        self.__parent_populate_list = list_updater
        
        if edit is None:
            self.__tmp = TempModel()
        else:
            self.__tmp = TempModel(edit.name, edit.description, 
                                   edit.value, edit.vulns, edit.owner)
        
        proxy_widgets = ['invent_name', 'invent_value', 'invent_description', 
                         'invent_owner']
        ProxyDelegate.__init__(self, self.__tmp, proxy_widgets, 'ui', 
                               toplevel_name = 'InventoryAddWindow', 
                               delete_handler = self.dialog_delete)  

        # Arvore de vulnerabilidades
        cols = [ Column('description', title = _('Description'), data_type = unicode, 
                        expand = True),
                 Column('state', title = _('Applicable?'), data_type = bool, 
                        editable = True)]
        
        self.tree = self.get_widget('invent_vuln_list')
        self.tree.set_columns(cols)
        self.owner_field = self.get_widget('invent_owner')
        
        all_owners = [x.name for x in Owner.query().all()]
        all_vulns = Vulnerability.query().all()

        self.owner_field.prefill(all_owners, True)
        
        if self.__edit is not None:
            edit = self.__edit
            for item in all_vulns:
                if item in edit.vulns:
                    vuln_to_add = vuln(item.description, True, id = item.id)
                else:
                    vuln_to_add = vuln(item.description, id = item.id)
                self.tree.append(vuln_to_add)
        else:
            for item in all_vulns:
                vuln_to_add = vuln(item.description, id = item.id)
                self.tree.append(vuln_to_add)
Exemplo n.º 10
0
 def __init__(self, toplevel=None):
     ProxyDelegate.__init__(self,
                            model=None,
                            toplevel=toplevel,
                            delete_handler=self.hide,
                            gladefile="editor",
                            widgets=("name",
                                     "address",
                                     "phones",
                                     "add_phone",
                                     "edit_phone",
                                     "remove_phone",
                                     "birthday",
                                     "category",
                                     "cancel",
                                     "ok"),
                            proxy_widgets=("name",
                                           "address",
                                           "birthday"))
     self.phones.set_columns([Column("number",
                                     title="Number",
                                     editable=True,
                                     expand=True)])
Exemplo n.º 11
0
#!/usr/bin/env python
from gi.repository import Gtk
from kiwi.model import PickledModel
from kiwi.ui.delegates import ProxyDelegate

# define the class that holds our application data


class Person(PickledModel):
    pass
person = Person.unpickle()

# create and run a proxy interface attached to person
view = ProxyDelegate(person, gladefile="Person.ui",
                     widgets=["address", 'name', 'phone'],
                     delete_handler=Gtk.main_quit)
view.focus_topmost()
view.show_and_loop()

# save changes done to the instance
person.save()
Exemplo n.º 12
0
#!/usr/bin/env python
import gtk
from kiwi.model import PickledModel
from kiwi.ui.delegates import ProxyDelegate

# define the class that holds our application data


class Person(PickledModel):
    pass


person = Person.unpickle()

# create and run a proxy interface attached to person
view = ProxyDelegate(person,
                     gladefile="Person.ui",
                     widgets=["address", 'name', 'phone'],
                     delete_handler=gtk.main_quit)
view.focus_topmost()
view.show_and_loop()

# save changes done to the instance
person.save()