diff options
| author | Claudine Peyrat <88194877+claudinepeyrat06@users.noreply.github.com> | 2025-06-22 07:01:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-22 07:01:02 +0200 |
| commit | 2c3be600c3a17f676853fd42e00c0c31d6c674da (patch) | |
| tree | d4fb6f7f1fa6dff0bbdf6c3da99d4f499f7f90f7 /lib/gui/element_info.py | |
| parent | f5dda6fc4505faa3c8f69abcfe1315a150e06604 (diff) | |
Claudine/unable element info copy (#3817)
* firststeps
* Update element_info.py
* Update element_info.py
* Update element_info.py
add some help
* make style...
* rename a variable and fix a mistake
* make headline nicer
Diffstat (limited to 'lib/gui/element_info.py')
| -rw-r--r-- | lib/gui/element_info.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/gui/element_info.py b/lib/gui/element_info.py index cee93e3e..a2f0824e 100644 --- a/lib/gui/element_info.py +++ b/lib/gui/element_info.py @@ -13,6 +13,7 @@ class ElementInfoFrame(wx.Frame): def __init__(self, *args, **kwargs): self.list_items = kwargs.pop("list_items") + self.export_txt = kwargs.pop("export_txt") self.index = 0 wx.Frame.__init__(self, None, wx.ID_ANY, _("Element Info"), *args, **kwargs) @@ -64,6 +65,18 @@ class ElementInfoFrame(wx.Frame): ) help_sizer.Add(self.website_link, 0, wx.ALL, 8) + copy_info_text = wx.StaticText( + self.help, + wx.ID_ANY, + _("Click on Copy to copy the information in the Clipboard"), + style=wx.ALIGN_LEFT + ) + help_sizer.Add(copy_info_text, 0, wx.ALL, 8) + + cmd_copy = wx.Button(self.help, wx.ID_COPY) + cmd_copy.Bind(wx.EVT_BUTTON, self.on_copy) + help_sizer.Add(cmd_copy, 0, wx.ALL, 8) + self.help.SetSizer(help_sizer) self.info.SetSizer(info_sizer) self.main_panel.SetSizer(notebook_sizer) @@ -72,6 +85,12 @@ class ElementInfoFrame(wx.Frame): self.Layout() + def on_copy(self, event): + if wx.TheClipboard.Open(): + text = self.export_txt + data_object = wx.TextDataObject(text) + wx.TheClipboard.SetData(data_object) + def _fill_info_list(self): for item in self.list_items: self.info_list.InsertItem(self.index, item.name) @@ -90,12 +109,13 @@ class ElementInfoFrame(wx.Frame): class ElementInfoApp(wx.App): - def __init__(self, list_items): + def __init__(self, list_items, export_txt): self.list_items = list_items + self.export_txt = export_txt super().__init__() def OnInit(self): - self.frame = ElementInfoFrame(list_items=self.list_items) + self.frame = ElementInfoFrame(list_items=self.list_items, export_txt=self.export_txt) self.SetTopWindow(self.frame) self.frame.Show() return True |
