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

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 a8ed421 was 77d92cd, checked in by lewis, 8 years ago

Add backbone for file converter

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