~earl.chew/zim/pyzim-refactor-umlet

« back to all changes in this revision

Viewing changes to zim/gui/widgets.py

  • Committer: Jaap Karssenberg
  • Date: 2013-09-30 18:43:31 UTC
  • Revision ID: jaap.karssenberg@gmail.com-20130930184331-7xz4lsk0goypsjyn
Refactored config dicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
2748
2748
        @ivar ui: parent C{gtk.Window} or C{GtkInterface}
2749
2749
        @ivar vbox: C{gtk.VBox} for main widgets of the dialog
2750
2750
        @ivar form: L{InputForm} added by C{add_form()}
2751
 
        @ivar uistate: L{ListDict} to store state of the dialog, persistent
 
2751
        @ivar uistate: L{ConfigDict} to store state of the dialog, persistent
2752
2752
        per notebook. The size and position of the dialog are stored as
2753
2753
        automatically in this dict already.
2754
2754
        @ivar result: result to be returned by L{run()}
2821
2821
                        title=format_title(title),
2822
2822
                        flags=gtk.DIALOG_NO_SEPARATOR|gtk.DIALOG_DESTROY_WITH_PARENT,
2823
2823
                )
 
2824
                if hasattr(ui, 'ui') and hasattr(ui.ui, 'uistate'):
 
2825
                                ui = ui.ui # HACK - we get other window instead.. - avoid triggering Mock objects in test ...
 
2826
 
2824
2827
                self.ui = ui
2825
2828
                self.result = None
2826
2829
                self._registered = False
2829
2832
                        self.vbox.set_spacing(5)
2830
2833
 
2831
2834
                if hasattr(self, 'uistate'):
2832
 
                        assert isinstance(self.uistate, zim.config.ListDict) # just to be sure
 
2835
                        assert isinstance(self.uistate, zim.config.ConfigDict) # just to be sure
2833
2836
                elif hasattr(ui, 'uistate') \
2834
 
                and isinstance(ui.uistate, zim.config.ConfigDict):
 
2837
                and isinstance(ui.uistate, zim.config.SectionedConfigDict):
2835
2838
                        key = self.__class__.__name__
2836
2839
                        self.uistate = ui.uistate[key]
2837
2840
                else:
2838
 
                        self.uistate = zim.config.ListDict()
 
2841
                        self.uistate = zim.config.ConfigDict()
2839
2842
 
2840
2843
                # note: _windowpos is defined with a leading "_" so it is not
2841
2844
                # persistent across instances, this is intentional to avoid