当前位置: 首页>>代码示例>>Python>>正文


Python managedwindow.ManagedWindow类代码示例

本文整理汇总了Python中gramps.gui.managedwindow.ManagedWindow的典型用法代码示例。如果您正苦于以下问题:Python ManagedWindow类的具体用法?Python ManagedWindow怎么用?Python ManagedWindow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ManagedWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, dbstate, user, options_class, name, callback=None):
        uistate = user.uistate
        self.dbstate = dbstate
        self.uistate = uistate

        tool.Tool.__init__(self, dbstate, options_class, name)
        ManagedWindow.__init__(self, uistate, [], self)
        self.qual = 0

        self.filterDialog = Glade(toplevel="filters")
        self.filterDialog.connect_signals(
            {
                "on_apply_clicked": self.on_apply_clicked,
                "on_editor_clicked": self.filter_editor_clicked,
                "on_help_clicked": self.on_help_clicked,
                "destroy_passed_object": self.close,
                "on_write_table": self.__dummy,
            }
        )

        window = self.filterDialog.toplevel
        self.filters = self.filterDialog.get_object("filter_list")
        self.label = _("Event comparison filter selection")
        self.set_window(window, self.filterDialog.get_object("title"), self.label)

        self.on_filters_changed("Person")
        uistate.connect("filters-changed", self.on_filters_changed)

        self.show()
开发者ID:jesslinn,项目名称:gramps,代码行数:29,代码来源:eventcmp.py

示例2: __init__

    def __init__(self, dbstate, user, options_class, name, callback=None):
        uistate = user.uistate

        tool.Tool.__init__(self, dbstate, options_class, name)
        ManagedWindow.__init__(self, uistate, [], self.__class__)
        self.callback = uistate.pulse_progressbar

        self.batch_ops = []
        self.build_batch_ops()

        self.assistant = Gtk.Assistant()
        self.set_window(self.assistant, None, _('Media Manager'))
        self.setup_configs('interface.mediaman', 780, 600)

        self.assistant.connect('close', self.do_close)
        self.assistant.connect('cancel', self.do_close)
        self.assistant.connect('apply', self.run)
        self.assistant.connect('prepare', self.prepare)

        intro = IntroductionPage()
        self.add_page(intro, Gtk.AssistantPageType.INTRO, _('Introduction'))
        self.selection = SelectionPage(self.batch_ops)
        self.add_page(self.selection, Gtk.AssistantPageType.CONTENT,
                      _('Selection'))
        self.settings = SettingsPage(self.batch_ops, self.assistant)
        self.add_page(self.settings, Gtk.AssistantPageType.CONTENT)
        self.confirmation = ConfirmationPage(self.batch_ops)
        self.add_page(self.confirmation, Gtk.AssistantPageType.CONFIRM,
                      _('Final confirmation'))
        self.conclusion = ConclusionPage(self.assistant)
        self.add_page(self.conclusion, Gtk.AssistantPageType.SUMMARY)

        self.show()
        self.assistant.set_forward_page_func(self.forward_page, None)
开发者ID:cz172638,项目名称:gramps,代码行数:34,代码来源:mediamanager.py

示例3: close

 def close(self, *obj):
     """ Close relcalc tool. Remove non-gtk connections so garbage
         collection can do its magic.
     """
     self.relationship.disconnect_db_signals(self.dbstate)
     self.sel.disconnect(self.changedkey)
     ManagedWindow.close(self, *obj)
开发者ID:cz172638,项目名称:gramps,代码行数:7,代码来源:relcalc.py

示例4: __init__

    def __init__(self, dbstate, user, options_class, name, callback=None):
        uistate = user.uistate

        self.label = _("Sources Index")
        self.base = os.path.dirname(__file__)

        ManagedWindow.__init__(self, uistate, [], self.__class__)
        self.set_window(Gtk.Window(), Gtk.Label(), "")

        tool.Tool.__init__(self, dbstate, options_class, name)

        glade_file = os.path.join(USER_PLUGINS, "SourceIndex", "death.glade")

        if gramps.gen.constfunc.lin():
            import locale

            locale.setlocale(locale.LC_ALL, "")
            # This is needed to make gtk.Builder work by specifying the
            # translations directory
            locale.bindtextdomain("addon", self.base + "/locale")

            self.glade = Gtk.Builder()
            self.glade.set_translation_domain("addon")

            self.glade.add_from_file(glade_file)

            from gi.repository import GObject

            GObject.GObject.__init__(self.glade)

            window = self.glade.get_object("edit_death")

            self.set_window(window, self.glade.get_object("title"), self.label)

            # self.wit_button = self.glade.get_object('add_wit')
            self.ok_button = self.glade.get_object("ok")
            self.quit_button = self.glade.get_object("cancel")

        else:

            # Glade class from gui/glade.py and gui/managedwindow.py
            self.top = Glade()
            window = self.top.toplevel
            self.set_window(window, None, glade_file)

            # self.wit_button = self.top.get_object('add_wit')
            self.ok_button = self.top.get_object("ok")
            self.quit_button = self.top.get_object("cancel")

        # self.wit_button.connect('clicked', GtkHandlers.on_witness_clicked)
        self.ok_button.connect("clicked", self.close)
        self.quit_button.connect("clicked", self.close)

        self.window.show()

        # tests
        filename = os.path.join(USER_PLUGINS, "SourceIndex", "test_death.xml")
        self.write_xml(filename, "D0001", "DATE", "NOM")
        self.parse_xml(filename)
开发者ID:tecknicaltom,项目名称:addons-source,代码行数:59,代码来源:death.py

示例5: __init__

    def __init__(self, dbstate, user, options_class, name, callback=None):
        uistate = user.uistate

        tool.Tool.__init__(self, dbstate, options_class, name)

        self.window_name = _('Media Verify Tool')
        ManagedWindow.__init__(self, uistate, [], self.__class__)

        self.dbstate = dbstate
        self.moved_files = []
        self.titles = [_('Moved/Renamed Files'), _('Missing Files'),
                       _('Duplicate Files'), _('Extra Files'),
                       _('No md5 Generated'), _('Errors')]
        self.models = []
        self.views = []

        window = Gtk.Window()
        vbox = Gtk.VBox()

        self.notebook = Gtk.Notebook()
        self.notebook.set_scrollable(True)
        for title in self.titles:
            self.create_tab(title)
        vbox.pack_start(self.notebook, True, True, 5)

        bbox = Gtk.HButtonBox()
        vbox.pack_start(bbox, False, False, 5)
        close = Gtk.Button(_('Close'))
        close.set_tooltip_text(_('Close the Media Verify Tool'))
        close.connect('clicked', self.close)
        generate = Gtk.Button(_('Generate'))
        generate.set_tooltip_text(_('Generate md5 hashes for media objects'))
        generate.connect('clicked', self.generate_md5)
        verify = Gtk.Button(_('Verify'))
        verify.set_tooltip_text(_('Check media paths and report missing, '
                                  'duplicate and extra files'))
        verify.connect('clicked', self.verify_media)
        export = Gtk.Button(_('Export'))
        export.set_tooltip_text(_('Export the results to a text file'))
        export.connect('clicked', self.export_results)
        fix = Gtk.Button(_('Fix'))
        fix.set_tooltip_text(_('Fix media paths of moved and renamed files'))
        fix.connect('clicked', self.fix_media)
        bbox.add(close)
        bbox.add(generate)
        bbox.add(verify)
        bbox.add(export)
        bbox.add(fix)
        vbox.show_all()

        window.add(vbox)
        window.set_size_request(500, 300)
        window.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)
        self.set_window(window, None, self.window_name)
        self.show()

        self.show_tabs()
开发者ID:daleathan,项目名称:addons-source,代码行数:57,代码来源:MediaVerify.py

示例6: __init__

    def __init__(self, dbstate, user, options_class, name, callback=None):
        uistate = user.uistate

        self.label = _('Sources Index')
        self.base = os.path.dirname(__file__)

        ManagedWindow.__init__(self, uistate,[], self.__class__)
        self.set_window(Gtk.Window(),Gtk.Label(),'')

        tool.Tool.__init__(self, dbstate, options_class, name)

        glade_file = os.path.join(USER_PLUGINS, "SourceIndex", "index.glade")

        if gramps.gen.constfunc.lin():
            import locale
            locale.setlocale(locale.LC_ALL, '')
            # This is needed to make gtk.Builder work by specifying the
            # translations directory
            locale.bindtextdomain("addon", self.base + "/locale")

            self.glade = Gtk.Builder()
            self.glade.set_translation_domain("addon")

            self.glade.add_from_file(glade_file)

            from gi.repository import GObject
            GObject.GObject.__init__(self.glade)

            self.top = self.glade.get_object('edit_index')

            self.set_window(self.top, self.glade.get_object('title'), self.label)

            self.birth_button = self.glade.get_object('add_b')
            self.death_button = self.glade.get_object('add_d')
            self.marriage_button = self.glade.get_object('add_m')
            self.census_button = self.glade.get_object('add_c')

            self.birth_button.connect('clicked', self.birth_editor)
            self.death_button.connect('clicked', self.death_editor)
            self.marriage_button.connect('clicked', self.marriage_editor)
            self.census_button.connect('clicked', self.census_editor)

        else:

            # Glade class from gui/glade.py and gui/managedwindow.py
            self.define_glade('edit_index', glade_file)
            self.set_window(self._gladeobj.toplevel, None, text=None, msg='Index')

            self.connect_button('add_b', self.birth_editor)
            self.connect_button('add_m', self.marriage_editor)
            self.connect_button('add_d', self.death_editor)
            self.connect_button('add_c', self.census_editor)

        #self.window.connect('delete-event', GladeHandlers.on_quit_clicked)

        self.window.show()
开发者ID:daleathan,项目名称:addons-source,代码行数:56,代码来源:index.py

示例7: __init__

    def __init__(self, dbstate, user, options_class, name, callback=None):
        uistate = user.uistate
        self.title = _('Unused Objects')

        tool.Tool.__init__(self, dbstate, options_class, name)

        if self.db.readonly:
            return

        ManagedWindow.__init__(self, uistate,[], self.__class__)
        UpdateCallback.__init__(self, self.uistate.pulse_progressbar)

        self.dbstate = dbstate
        self.uistate = uistate

        self.tables = {
            'events'  : {'get_func': self.db.get_event_from_handle,
                         'remove'  : self.db.remove_event,
                         'get_text': self.get_event_text,
                         'editor'  : 'EditEvent',
                         'icon'    : 'gramps-event',
                         'name_ix' : 4},
            'sources' : {'get_func': self.db.get_source_from_handle,
                         'remove'  : self.db.remove_source,
                         'get_text': None,
                         'editor'  : 'EditSource',
                         'icon'    : 'gramps-source',
                         'name_ix' : 2},
            'places'  : {'get_func': self.db.get_place_from_handle,
                         'remove'  : self.db.remove_place,
                         'get_text': None,
                         'editor'  : 'EditPlace',
                         'icon'    : 'gramps-place',
                         'name_ix' : 2},
            'media'   : {'get_func': self.db.get_object_from_handle,
                         'remove'  : self.db.remove_object,
                         'get_text': None,
                         'editor'  : 'EditMedia',
                         'icon'    : 'gramps-media',
                         'name_ix' : 4},
            'repos'   : {'get_func': self.db.get_repository_from_handle,
                         'remove'  : self.db.remove_repository,
                         'get_text': None,
                         'editor'  : 'EditRepository',
                         'icon'    : 'gramps-repository',
                         'name_ix' : 3},
            'notes'   : {'get_func': self.db.get_note_from_handle,
                         'remove'  : self.db.remove_note,
                         'get_text': self.get_note_text,
                         'editor'  : 'EditNote',
                         'icon'    : 'gramps-notes',
                         'name_ix' : 2},
            }

        self.init_gui()
开发者ID:doczkal,项目名称:gramps,代码行数:55,代码来源:removeunused.py

示例8: __init__

    def __init__(self, dbstate, user, options_class, name, callback=None):
        uistate = user.uistate
        self.label = _("Gender Statistics tool")
        tool.Tool.__init__(self, dbstate, options_class, name)

        stats_list = []
        for name, value in dbstate.db.genderStats.stats.items():
            stats_list.append(
                (name,)
                + value
                + (_GENDER[dbstate.db.genderStats.guess_gender(name)],)
                )

        if uistate:
            ManagedWindow.__init__(self, uistate, [], self.__class__)

            titles = [(_('Name'), 0, 100),
                      (_('Male'), 1, 70, INTEGER),
                      (_('Female'), 2, 70, INTEGER),
                      (_('Unknown'), 3, 90, INTEGER),
                      (_('Guess'), 4, 70)]

            treeview = Gtk.TreeView()
            model = ListModel(treeview, titles)
            for entry in sorted(stats_list):
                model.add(entry, entry[0])

            s = Gtk.ScrolledWindow()
            s.add(treeview)
            dialog = Gtk.Dialog()
            dialog.add_button(_('_Close'), Gtk.ResponseType.CLOSE)
            dialog.connect('response', self._response)
            dialog.vbox.pack_start(s, expand=True, fill=True, padding=0)
            self.set_window(dialog, None, self.label)
            self.setup_configs('interface.dumpgenderstats', 420, 300)
            self.show()

        else:
            if len(_('Name')) < 16:
                print('%s%s%s' % (_('Name'),
                                  " " * (16 - len(_('Name'))),
                                  _('Male')),
                      '\t%s'*3 % (_('Female'), _('Unknown'), _('Guess')))
            else:
                print(_('Name'), '\t%s'*4 % (_('Male'), _('Female'),
                                             _('Unknown'), _('Guess')))
            print()
            for entry in sorted(stats_list):
                if len(entry[0]) < 16:
                    print('%s%s%s' % (entry[0],
                                      " " * (16 - len(entry[0])),
                                      entry[1]),
                          '\t%s'*3 % (entry[2:]))
                else:
                    print(entry[0], '\t%s'*4 % (entry[1:]))
开发者ID:SNoiraud,项目名称:gramps,代码行数:55,代码来源:dumpgenderstats.py

示例9: __init__

    def __init__(self, dbstate, user, options_class, name, callback=None):
        self.uistate = user.uistate
        self.db = dbstate.db

        if self.uistate:
            tool.BatchTool.__init__(self, dbstate, user, options_class, name)
            if self.fail:
                return   # user denied to modify Gramps IDs

        ManagedWindow.__init__(self, self.uistate, [], self.__class__)
        if not self.uistate:
            UpdateCallback.__init__(self, user.callback)

        self.object_status = True
        self.change_status = False
        self.start_zero = True
        self.step_cnt, self.step_list = 0, ['1', '2', '5', '10']
        self.keep_status = True

        self.obj_values = {}   # enable access to all internal values
        self.active_entries, self.format_entries = {}, {}
        self.change_entries = {}
        self.start_entries, self.step_entries = {}, {}
        self.keep_entries = {}

        self.prim_methods, self.obj_methods = {}, {}
        for prim_obj, prim_objs in self.xobjects:
            iter_handles = "iter_%s_handles" % prim_obj
            get_number_obj = "get_number_of_%s" % prim_objs
            prefix_fmt = "%s_prefix" % prim_obj
            get_from_id = "get_%s_from_gramps_id" % prim_obj
            get_from_handle = "get_%s_from_handle" % prim_obj
            next_from_id = "find_next_%s_gramps_id" % prim_obj
            commit = "commit_%s" % prim_obj

            self.prim_methods[prim_obj] = (getattr(self.db, prefix_fmt),
                                           getattr(self.db, get_number_obj)(),
                                           getattr(self.db, next_from_id)())
            self.obj_methods[prim_obj] = (getattr(self.db, iter_handles),
                                          getattr(self.db, commit),
                                          getattr(self.db, get_from_id),
                                          getattr(self.db, get_from_handle),
                                          getattr(self.db, next_from_id))

            object_fmt, quant_id, next_id = self.prim_methods[prim_obj]

            obj_value = ReorderEntry(object_fmt, quant_id, next_id, prim_obj)
            self.obj_values[prim_obj] = obj_value

        if self.uistate:
            self._display()
        else:
            self._execute()
开发者ID:prculley,项目名称:gramps,代码行数:53,代码来源:reorderids.py

示例10: close

 def close(self, *args):
     """
     Close the editor window.
     """
     (width, height) = self.window.get_size()
     self._config.set('interface.census-width', width)
     self._config.set('interface.census-height', height)
     self._config.save()
     self.details.entry_grid.clean_up()
     self.details.clean_up()
     self.gallery_list.clean_up()
     ManagedWindow.close(self)
开发者ID:SNoiraud,项目名称:addons-source,代码行数:12,代码来源:CensusGramplet.py

示例11: __init__

    def __init__(self, dbstate, user, options_class, name, callback=None):
        uistate = user.uistate

        tool.Tool.__init__(self, dbstate, options_class, name)
        ManagedWindow.__init__(self, uistate, [],
                                             self.__class__)
        self.dbstate = dbstate
        self.uistate = uistate
        self.map = {}
        self.list = []
        self.index = 0
        self.merger = None
        self.mergee = None
        self.removed = {}
        self.update = callback
        self.use_soundex = 1

        top = Glade()

        # retrieve options
        threshold = self.options.handler.options_dict['threshold']
        use_soundex = self.options.handler.options_dict['soundex']

        my_menu = Gtk.ListStore(str, object)
        for val in sorted(_val2label):
            my_menu.append([_val2label[val], val])

        self.soundex_obj = top.get_object("soundex")
        self.soundex_obj.set_active(use_soundex)
        self.soundex_obj.show()

        self.menu = top.get_object("menu")
        self.menu.set_model(my_menu)
        self.menu.set_active(0)

        window = top.toplevel
        self.set_window(window, top.get_object('title'),
                        _('Find Possible Duplicate People'))
        self.setup_configs('interface.duplicatepeopletool', 350, 220)

        top.connect_signals({
            "on_do_merge_clicked"   : self.__dummy,
            "on_help_show_clicked"  : self.__dummy,
            "on_delete_show_event"  : self.__dummy,
            "on_merge_ok_clicked"   : self.on_merge_ok_clicked,
            "destroy_passed_object" : self.close,
            "on_help_clicked"       : self.on_help_clicked,
            "on_delete_merge_event" : self.close,
            "on_delete_event"       : self.close,
            })

        self.show()
开发者ID:ewongbb,项目名称:gramps,代码行数:52,代码来源:finddupes.py

示例12: close

 def close(self, *args):
     """
     Close the editor window.
     """
     (width, height) = self.window.get_size()
     self._config.set('interface.form-width', width)
     self._config.set('interface.form-height', height)
     (width, height) = self.window.get_position()
     self._config.set('interface.form-horiz-position', width)
     self._config.set('interface.form-vert-position', height)
     self._config.save()
     self.gallery_list.clean_up()
     ManagedWindow.close(self)
开发者ID:daleathan,项目名称:addons-source,代码行数:13,代码来源:editform.py

示例13: __init__

    def __init__(self, dbstate, user, options_class, name, callback=None):
        self.uistate = user.uistate
        self.label = _('Extract Place data')

        ManagedWindow.__init__(self, self.uistate, [], self.__class__)
        self.set_window(Gtk.Window(), Gtk.Label(), '')

        tool.BatchTool.__init__(self, dbstate, user, options_class, name)

        if not self.fail:
            self.uistate.set_busy_cursor(True)
            self.run(dbstate.db)
            self.uistate.set_busy_cursor(False)
开发者ID:daleathan,项目名称:addons-source,代码行数:13,代码来源:extractcity.py

示例14: __init__

    def __init__(self, dbstate, user, options_class, name, callback=None):
        uistate = user.uistate
        
        ManagedWindow.__init__(self, uistate, [], self.__class__)
        self.dbstate = dbstate
        self.set_window(Gtk.Window(), Gtk.Label(), '')

        tool.BatchTool.__init__(self, dbstate, user, options_class, name)

        if not self.fail:
            uistate.set_busy_cursor(True)
            self.run()
            uistate.set_busy_cursor(False)
开发者ID:fatso83,项目名称:gramps,代码行数:13,代码来源:mergecitations.py

示例15: __init__

    def __init__(self, dbstate, user, options_class, name, callback=None):
        uistate = user.uistate
        self.label = _("Associations state tool")
        tool.Tool.__init__(self, dbstate, options_class, name)
        if uistate:
            ManagedWindow.__init__(self,uistate,[],
                                                 self.__class__)

        stats_list = []

        plist = dbstate.db.get_person_handles(sort_handles=True)

        for handle in plist:
            person = dbstate.db.get_person_from_handle(handle)
            name1 = name_displayer.display(person)
            refs = person.get_person_ref_list()
            if refs:
                for ref in person.serialize()[-1]:
                    (a, b, c, two, value) = ref
                    person2 = dbstate.db.get_person_from_handle(two)
                    name2 = name_displayer.display(person2)
                    stats_list.append((name1, value, name2))

        if uistate:
            titles = [
                (_('Name'), 0, 200),
                (_('Type of link'), 1, 200),
                (_('Of'), 2, 200),
                ]

            treeview = Gtk.TreeView()
            model = ListModel(treeview, titles)
            for entry in stats_list:
                model.add(entry, entry[0])

            window = Gtk.Window()
            window.set_default_size(800, 600)
            s = Gtk.ScrolledWindow()
            s.add(treeview)
            window.add(s)
            window.show_all()
            self.set_window(window, None, self.label)
            self.show()

        else:
            print('\t%s'*3 % ('Name','Type of link','Of'))
            print()
            for entry in stats_list:
                print('\t%s'*3 % entry)
开发者ID:belissent,项目名称:addons-source,代码行数:49,代码来源:associationstool.py


注:本文中的gramps.gui.managedwindow.ManagedWindow类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。