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

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 80f4684 was ba65aff, checked in by lewis, 8 years ago

Add docstrings & comments, and rename old bsl_loader to otoko_loader

  • Property mode set to 100644
File size: 1.4 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
9class Plugin(PluginBase):
10    """
11    This class defines the interface for a Plugin class
12    for File Converter perspective
13    """
14
15    def __init__(self):
16        PluginBase.__init__(self, name="File Converter")
17        logging.info("File Converter plug-in started")
18        self._sub_menu = "Tool"
19        self.converter_frame = None
20
21    def get_tools(self):
22        """
23        Returns a set of menu entries
24        """
25        help_txt = "Convert single column ASCII data to CanSAS format"
26        return [("File Converter", help_txt, self.on_file_converter)]
27
28    def on_file_converter(self, event):
29        if self.converter_frame is None:
30            frame = ConverterWindow(parent=self.parent, base=self.parent,
31                manager=self)
32            self.put_icon(frame)
33            self.converter_frame = frame
34        else:
35            self.converter_frame.Show(False)
36        self.converter_frame.Show(True)
37
38    def put_icon(self, frame):
39        """
40        Put icon in the frame title bar
41        """
42        if hasattr(frame, "IsIconized"):
43            if not frame.IsIconized():
44                try:
45                    icon = self.parent.GetIcon()
46                    frame.SetIcon(icon)
47                except:
48                    pass
Note: See TracBrowser for help on using the repository browser.