18 from wx.adv
import HyperlinkCtrl
21 from ..context
import LOG
22 from ..publish
import RideLogException
23 from ..widgets
import Label, RIDEDialog
43 def __init__(self, notebook, plugins, activation_callback):
44 RIDEDialog.__init__(self, parent=notebook, title=
"Manage Plugins", size=(800, 600))
45 self.SetBackgroundColour(Colour(self.color_background))
46 self.SetForegroundColour(Colour(self.color_foreground))
47 sizer = wx.BoxSizer(wx.VERTICAL)
48 sizer.Add(self.
_create_header_create_header(), 0, flag=wx.EXPAND | wx.LEFT |
49 wx.RIGHT | wx.TOP, border=16)
51 flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=16)
52 sizer.Add(self.
_create_line_create_line(), 0, flag=wx.EXPAND | wx.LEFT | wx.RIGHT)
53 sizer.Add(self.
_create_body_create_body(plugins, activation_callback), 1,
54 flag=wx.EXPAND | wx.ALL, border=16)
59 header = Label(self, wx.ID_ANY,
"Installed Plugins\n")
60 self.
fontfont = self.GetFont()
61 self.
fontfont.SetPointSize(self.font_size)
66 self.SetFont(self.
fontfont)
67 header.SetFont(wx.Font(wx.FontInfo(14
if self.font_size<=11
else self.font_size + 3).Bold()))
71 return wx.StaticLine(self)
74 panel = ScrolledPanel(self, wx.ID_ANY, style=wx.TAB_TRAVERSAL | wx.SIZE_AUTO)
75 panel.SetupScrolling()
76 sizer = wx.FlexGridSizer(0, 2, hgap=8, vgap=8)
77 sizer.AddGrowableCol(1, 1)
78 sizer.Add(self.
_create_label_create_label(panel,
'Enabled'), 0, wx.BOTTOM, border=8)
79 sizer.Add(self.
_create_label_create_label(panel,
'Plugin'), 0, wx.BOTTOM | wx.EXPAND, border=8)
80 for plugin
in sorted(plugins, key=
lambda p: p.name):
83 flag=wx.ALIGN_CENTER_HORIZONTAL)
84 sizer.Add(
_PluginRow(panel, plugin), 0, wx.EXPAND)
89 info = wx.StaticText(self, wx.ID_ANY,
90 "Info. Enabling and disabling plugins might"
91 " require RIDE restart "
93 info.SetFont(wx.Font(wx.FontInfo(12).Family(wx.FONTFAMILY_SWISS).Bold(
False)))
97 boldFont = self.GetFont()
100 boldFont.SetFaceName(self.
font_facefont_face)
101 boldFont.SetWeight(wx.FONTWEIGHT_BOLD)
102 boldFont.SetPointSize(self.font_size)
103 label = Label(parent, wx.ID_ANY, text)
104 label.SetFont(boldFont)
110 def __init__(self, parent, plugin, activation_callback):
111 wx.CheckBox.__init__(self, parent)
112 self.SetValue(plugin.enabled)
113 self.Bind(wx.EVT_CHECKBOX, self.
OnCheckBoxOnCheckBox)
120 if event.IsChecked():
129 except Exception
as err:
132 msg =
'Failed to %s plugin %s:\n%s\n\nYou should restart RIDE now!' % (method.__name__,
135 self.
_plugin_plugin.error = err
144 wx.Panel.__init__(self, parent)
145 sizer = wx.BoxSizer(wx.VERTICAL)
146 sizer.Add(self.
_get_name_get_name(plugin))
147 for name, value
in plugin.metadata.items():
150 config = plugin.config_panel(self)
152 sizer.Add(config, 1, wx.EXPAND | wx.LEFT, border=16)
156 return Label(self, label=plugin.name)
159 sizer = wx.BoxSizer(wx.HORIZONTAL)
160 sizer.Add(Label(self, label=
'%s: ' % name))
161 if value.split(
'://')[0]
in [
'http',
'https']:
162 sizer.Add(HyperlinkCtrl(self, -1, label=value, url=value))
164 sizer.Add(Label(self, label=value))
168 desc = Label(self, label=plugin.doc)
170 desc.SetForegroundColour(
"firebrick")
This class represents a general purpose log message with a traceback appended to message text.
def __init__(self, notebook)
def OnCheckBox(self, event)
def __init__(self, parent, plugin, activation_callback)
def _execute(self, method)
def _create_info_text(self)
def _create_body(self, plugins, activation_callback)
def _create_label(self, parent, text)
def __init__(self, notebook, plugins, activation_callback)
def _get_metadata(self, name, value)
def _get_name(self, plugin)
def _get_description(self, plugin)
def __init__(self, parent, plugin)