~ubuntu-branches/ubuntu/raring/wxwidgets2.8/raring

« back to all changes in this revision

Viewing changes to wxPython/wx/tools/Editra/src/plugdlg.py

  • Committer: Package Import Robot
  • Author(s): Stéphane Graber
  • Date: 2012-01-07 13:59:25 UTC
  • mfrom: (1.1.9) (5.1.10 sid)
  • Revision ID: package-import@ubuntu.com-20120107135925-2601miy9ullcon9j
Tags: 2.8.12.1-6ubuntu1
* Resync from Debian, changes that were kept:
  - debian/rules: re-enable mediactrl. This allows libwx_gtk2u_media-2.8 to be
    built, as this is required by some applications (LP: #632984)
  - debian/control: Build-dep on libxt-dev for mediactrl.
  - Patches
    + fix-bashism-in-example
* Add conflict on python-wxgtk2.8 (<< 2.8.12.1-6ubuntu1~) to python-wxversion
  to guarantee upgrade ordering when moving from pycentral to dh_python2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
"""
16
16
 
17
17
__author__ = "Cody Precord <cprecord@editra.org>"
18
 
__cvsid__ = "$Id: plugdlg.py 63588 2010-02-28 16:33:16Z CJP $"
19
 
__revision__ = "$Revision: 63588 $"
 
18
__cvsid__ = "$Id: plugdlg.py 67856 2011-06-04 21:14:06Z CJP $"
 
19
__revision__ = "$Revision: 67856 $"
20
20
 
21
21
#-----------------------------------------------------------------------------#
22
22
# Imports
101
101
 
102
102
    """
103
103
    def __init__(self, parent, id=wx.ID_ANY, title=u'', size=wx.DefaultSize):
104
 
        wx.Frame.__init__(self, parent, title=title, size=size,
105
 
                              style=wx.DEFAULT_FRAME_STYLE)
 
104
        super(PluginDialog, self).__init__(parent, title=title, size=size,
 
105
                                           style=wx.DEFAULT_FRAME_STYLE)
106
106
        util.SetWindowIcon(self)
107
107
 
108
108
        # Attributes
138
138
        # Event Handlers
139
139
        self.Bind(eclib.EVT_SB_PAGE_CHANGING, self.OnPageChanging)
140
140
        self.Bind(wx.EVT_CLOSE, self.OnClose)
 
141
        self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy, self)
141
142
 
142
143
        # Message Handlers
143
144
        ed_msg.Subscribe(self.OnThemeChange, ed_msg.EDMSG_THEME_CHANGED)
144
145
 
145
 
    def __del__(self):
146
 
        ed_msg.Unsubscribe(self.OnThemeChange)
 
146
    def OnDestroy(self, evt):
 
147
        if evt.GetId() == self.GetId():
 
148
            ed_msg.Unsubscribe(self.OnThemeChange)
 
149
        evt.Skip()
147
150
 
148
151
    def __InitImageList(self):
149
152
        """Initialize the segmentbooks image list"""
268
271
        else:
269
272
            self.PopulateErrors()
270
273
 
271
 
#        cbar = self.CreateControlBar(wx.BOTTOM)
272
 
#        cbar.SetVMargin(1, 2)
273
 
#        cbar.AddStretchSpacer()
274
 
#        btn = wx.Button(cbar, id=ConfigPanel.ID_UNINSTALL, label=_("Uninstall"))
275
 
#        cbar.AddControl(btn, wx.ALIGN_RIGHT)
276
 
 
277
 
        # Event handlers
278
 
#        self.Bind(wx.EVT_BUTTON, self.OnUninstall, id=ConfigPanel.ID_UNINSTALL)
 
274
        # Event Handlers
279
275
        self.Bind(ed_event.EVT_NOTIFY, self.OnNotify)
280
276
 
281
277
    def ConfigChanged(self):
367
363
 
368
364
            pdata = PluginData()
369
365
            pdata.SetName(item)
370
 
            desc = getattr(mod, '__doc__', _("No Description Available"))
 
366
            desc = getattr(mod, '__doc__', None)
 
367
            if not isinstance(desc, basestring):
 
368
                desc = _("No Description Available")
371
369
            pdata.SetDescription(desc.strip())
372
370
            pdata.SetAuthor(getattr(mod, '__author__', _("Unknown")))
373
371
            pdata.SetVersion(version)
416
414
                item = dist.project_name
417
415
                version = dist.version
418
416
            else:
419
 
                version = str(getattr(mod, '__version__', _("Unknown")))
 
417
                version = unicode(getattr(mod, '__version__', _("Unknown")))
420
418
 
421
419
            pin = PluginData()
422
420
            pin.SetName(item)
423
421
            pin.SetAuthor(getattr(mod, '__author__', _("Unknown")))
424
422
            pin.SetVersion(version)
425
423
            pin.SetDist(dist)
426
 
            pbi = PluginErrorItem(self._list, pin, bmp, item)
 
424
            pbi = PluginErrorItem(self._list, pin, msg, bmp=bmp)
427
425
 
428
426
            self._list.AppendItem(pbi)
429
427
            self._list.Thaw()
951
949
        bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_DELETE), wx.ART_MENU)
952
950
        self._uninstall = eclib.PlateButton(self, label=_("Uninstall"), bmp=bmp,
953
951
                                            style=eclib.PB_STYLE_NOBG)
 
952
        self._uninstall.Unbind(wx.EVT_ERASE_BACKGROUND)
954
953
        bmp = wx.ArtProvider.GetBitmap(str(ed_glob.ID_PREF), wx.ART_MENU)
955
954
        self._config = eclib.PlateButton(self,
956
955
                                         label=_("Configure"), bmp=bmp,
957
956
                                         style=eclib.PB_STYLE_NOBG)
 
957
        self._config.Unbind(wx.EVT_ERASE_BACKGROUND)
958
958
        self._config.Enable(enabled)
959
959
 
960
960
        # Setup
1112
1112
 
1113
1113
class PluginErrorItem(eclib.PanelBoxItemBase):
1114
1114
    """PanelBox Item to display configuration information about a plugin."""
1115
 
    def __init__(self, parent, bmp,
1116
 
                 title=u'Plugin Name', version=u'0.0',
1117
 
                 msg=u'Description', auth='John Doe'):
 
1115
    def __init__(self, parent, pdata, msg, bmp):
1118
1116
        """Create the PanelBoxItem
1119
1117
        @param parent: L{PanelBox}
 
1118
        @param pdata: PluginData
 
1119
        @param msg: error msg
 
1120
        @param bmp: Bitmap
1120
1121
 
1121
1122
        """
1122
1123
        super(PluginErrorItem, self).__init__(parent)
1123
1124
 
1124
1125
        # Attributes
1125
1126
        self._bmp = bmp
1126
 
        self._title = wx.StaticText(self, label=title)
1127
 
        self._version = wx.StaticText(self, label=version)
 
1127
        self._title = wx.StaticText(self, label=pdata.GetName())
 
1128
        self._version = wx.StaticText(self, label=pdata.GetVersion())
1128
1129
        self._msg = wx.StaticText(self, label=msg)
1129
 
        self._auth = wx.StaticText(self, label=_("Author: %s") % auth)
 
1130
        self._auth = wx.StaticText(self, label=_("Author: %s") % pdata.GetAuthor())
1130
1131
 
1131
1132
        # Setup
1132
1133
        font = self._title.GetFont()