6 from Vispa.Main.VispaPlugin
import VispaPlugin
7 from Vispa.Views.AbstractView
import AbstractView
8 from Vispa.Main.Exceptions
import NoCurrentTabControllerException
11 """ The BrowserPlugin supplies the view menu and supports center views.
15 logging.debug(__name__ +
": __init__")
16 VispaPlugin.__init__(self, application)
39 """ Fill specific menu.
41 self.
_viewMenu = self.application().createPluginMenu(
'&View')
48 self._viewMenu.addSeparator()
57 self._viewMenu.addSeparator()
63 """ Calls expandAll() function of tree view.
66 self.application().currentTabController().tab().treeView().expandAll()
67 except NoCurrentTabControllerException:
68 logging.warning(self.__class__.__name__ +
": _expandAll() - No tab controller found.")
71 """ Calls expandToDepthDialog() function of current tab controller.
74 self.application().currentTabController().tab().treeView().expandToDepthDialog()
75 except NoCurrentTabControllerException:
76 logging.warning(self.__class__.__name__ +
": _expandToDepth() - No tab controller found.")
79 """ Calls collapseAll() function of tree view.
82 self.application().currentTabController().tab().treeView().collapseAll()
83 except NoCurrentTabControllerException:
84 logging.warning(self.__class__.__name__ +
": _collapseAll() - No tab controller found.")
87 """ Calls filterDialog() function of current tab controller.
91 except NoCurrentTabControllerException:
92 logging.warning(self.__class__.__name__ +
": filterDialog() - No tab controller found.")
95 """ Calls showBoxContentDialog() function of current tab controller.
98 self.application().currentTabController().showBoxContentDialog()
99 except NoCurrentTabControllerException:
100 logging.warning(self.__class__.__name__ +
": showBoxContentDialog() - No tab controller found.")
103 """ Calls zoomDialog() function of current tab controller.
106 self.application().currentTabController().
zoomDialog()
107 except NoCurrentTabControllerException:
108 logging.warning(self.__class__.__name__ +
": zoomDialog() - No tab controller found.")
111 """ Calls saveImage() function of current tab controller.
114 self.application().currentTabController().
saveImage()
115 except NoCurrentTabControllerException:
116 logging.warning(self.__class__.__name__ +
": saveImage() - No tab controller found.")
121 return str(viewClass) + str(viewClass.LABEL)
124 """ add a View for the Center View
126 selection: name is the menu entry, function the function to be
127 added as action if the menu is selecteds
129 logging.debug(__name__ +
": addCenterView")
130 if not issubclass(viewClass, AbstractView):
131 logging.error(self.__class__.__name__ +
": addCenterView() - Cannot add non views as view. Aborting...")
134 logging.warning(self.__class__.__name__ +
": Already have a View of type "+ viewClass.__name__ +
". Aborting...")
138 action.setCheckable(
True)
139 action.setEnabled(enabled)
142 action.setData(QVariant(viewClassId))
145 self._availableCenterViews.append(viewClass)
146 self._viewMenu.addAction(action)
149 """ Slot for center view menu entries.
151 It switches the tab's current center view to the selected view.
155 self.application().currentTabController().switchCenterView(requestedViewClassId)
156 except NoCurrentTabControllerException:
157 logging.warning(self.__class__.__name__ +
": switchCenterViewSlot() - No tab controller found.")
160 """ Open the requested file in a new tab.
162 This method is called when the user wants to open a file with an extension this plugin.
163 previously registered.
165 This methods overwrites openFile from VispaPlugin.
167 logging.debug(__name__ +
": openFile " + filename)
172 base = os.path.basename(filename)
173 ext = os.path.splitext(base)[1].lower().
strip(
".")
174 if ext
in [ft.extension()
for ft
in self.filetypes()]:
176 return tab.controller().open(filename)
180 raise NotImplementedError
def _showBoxContentDialog
def disabledCenterViewIds
std::string toString(const std::pair< T, T > &aT)
def setDisabledCenterViewIds