source: sasview/src/sas/sasgui/perspectives/file_converter/file_converter.py @ c972e3a

ESS_GUIESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalc
Last change on this file since c972e3a 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
Line 
1"""
2File Converter Plugin
3"""
4
5import logging
6from sas.sasgui.guiframe.plugin_base import PluginBase
7from sas.sasgui.perspectives.file_converter.converter_panel import ConverterWindow
8
9logger = logging.getLogger(__name__)
10
11class Plugin(PluginBase):
12    """
13    This class defines the interface for a Plugin class
14    for File Converter perspective
15    """
16
17    def __init__(self):
18        PluginBase.__init__(self, name="File Converter")
19        logger.info("File Converter plug-in started")
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        """
27        help_txt = "Convert ASCII or BSL/OTOKO data to CanSAS or NXcanSAS formats"
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.