magnetic_scattrelease-4.2.2ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change
on this file since 20fa5fe was
94e3572,
checked in by lewis, 7 years ago
|
Update file converter tooltip in tools menu
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[77d92cd] | 1 | """ |
---|
| 2 | File Converter Plugin |
---|
| 3 | """ |
---|
| 4 | |
---|
| 5 | import logging |
---|
| 6 | from sas.sasgui.guiframe.plugin_base import PluginBase |
---|
| 7 | from sas.sasgui.perspectives.file_converter.converter_panel import ConverterWindow |
---|
| 8 | |
---|
[463e7ffc] | 9 | logger = logging.getLogger(__name__) |
---|
[c155a16] | 10 | |
---|
[77d92cd] | 11 | class Plugin(PluginBase): |
---|
[ba65aff] | 12 | """ |
---|
| 13 | This class defines the interface for a Plugin class |
---|
| 14 | for File Converter perspective |
---|
| 15 | """ |
---|
[77d92cd] | 16 | |
---|
| 17 | def __init__(self): |
---|
| 18 | PluginBase.__init__(self, name="File Converter") |
---|
[c155a16] | 19 | logger.info("File Converter plug-in started") |
---|
[77d92cd] | 20 | self._sub_menu = "Tool" |
---|
| 21 | self.converter_frame = None |
---|
| 22 | |
---|
| 23 | def get_tools(self): |
---|
| 24 | """ |
---|
| 25 | Returns a set of menu entries |
---|
| 26 | """ |
---|
[94e3572] | 27 | help_txt = "Convert ASCII or BSL/OTOKO data to CanSAS or NXcanSAS formats" |
---|
[77d92cd] | 28 | return [("File Converter", help_txt, self.on_file_converter)] |
---|
| 29 | |
---|
| 30 | def on_file_converter(self, event): |
---|
| 31 | if self.converter_frame is None: |
---|
| 32 | frame = ConverterWindow(parent=self.parent, base=self.parent, |
---|
| 33 | manager=self) |
---|
| 34 | self.put_icon(frame) |
---|
| 35 | self.converter_frame = frame |
---|
| 36 | else: |
---|
| 37 | self.converter_frame.Show(False) |
---|
| 38 | self.converter_frame.Show(True) |
---|
| 39 | |
---|
| 40 | def put_icon(self, frame): |
---|
| 41 | """ |
---|
| 42 | Put icon in the frame title bar |
---|
| 43 | """ |
---|
| 44 | if hasattr(frame, "IsIconized"): |
---|
| 45 | if not frame.IsIconized(): |
---|
| 46 | try: |
---|
| 47 | icon = self.parent.GetIcon() |
---|
| 48 | frame.SetIcon(icon) |
---|
| 49 | except: |
---|
| 50 | pass |
---|
Note: See
TracBrowser
for help on using the repository browser.