Exemplo n.º 1
0
 def __init__(self, application):
     Plugin.__init__(self, application, default_settings=self.defaults)
     self.settings = application.settings._config_obj['Plugins']['Tree']
     self._parent = None
     self._tree = self.tree
     self._mgr = GetManager(self._tree)
     """
Exemplo n.º 2
0
 def __init__(self, application, controller=None):
     Plugin.__init__(self, application, default_settings=self.defaults)
     self.settings = application.settings._config_obj['Plugins'][
         'File Explorer']
     self._parent = None
     self._filemgr = self.filemgr
     self._mgr = GetManager(self._filemgr)
     self._controller = controller
Exemplo n.º 3
0
 def __init__(self, application, controller=None):
     Plugin.__init__(self, application, default_settings=self.defaults)
     self.settings = application.settings._config_obj['Plugins'][
         'File Explorer']
     self._parent = wx.App.Get().GetTopWindow()
     self._filemgr = self.filemgr
     self._filemgr.SetThemeEnabled(True)
     self._mgr = GetManager(self._filemgr)
     self._controller = controller
Exemplo n.º 4
0
 def __init__(self, application):
     Plugin.__init__(self, application, default_settings=self.defaults)
     self.settings = application.settings._config_obj['Plugins']['Tree']
     self._parent = None
     self._tree = self.tree
     """
     self._tree.SetBackgroundColour(Colour(200, 222, 40))
     self._tree.SetOwnBackgroundColour(Colour(200, 222, 40))
     self._tree.SetForegroundColour(Colour(7, 0, 70))
     self._tree.SetOwnForegroundColour(Colour(7, 0, 70))
     """
     self._mgr = GetManager(self._tree)
     """
     self._action_registerer = action_registerer
     self.tree = parent.tree
     """
     self._model = self.model
     # self._tree.Bind(wx.EVT_UPDATE_UI, self.OnShowTree)
     self._tree.Bind(wx.EVT_SHOW, self.OnShowTree)
     self._tree.Bind(wx.EVT_MOVE, self.OnTabChanged)
Exemplo n.º 5
0
class TreePlugin(Plugin):
    """Provides a tree view for Test Suites """
    datafile = property(lambda self: self.get_selected_datafile())
    defaults = {"opened": True, "docked": True}

    def __init__(self, application):
        Plugin.__init__(self, application, default_settings=self.defaults)
        self.settings = application.settings._config_obj['Plugins']['Tree']
        self._parent = None
        self._tree = self.tree
        """
        self._tree.SetBackgroundColour(Colour(200, 222, 40))
        self._tree.SetOwnBackgroundColour(Colour(200, 222, 40))
        self._tree.SetForegroundColour(Colour(7, 0, 70))
        self._tree.SetOwnForegroundColour(Colour(7, 0, 70))
        """
        self._mgr = GetManager(self._tree)
        """
        self._action_registerer = action_registerer
        self.tree = parent.tree
        """
        self._model = self.model
        # self._tree.Bind(wx.EVT_UPDATE_UI, self.OnShowTree)
        self._tree.Bind(wx.EVT_SHOW, self.OnShowTree)
        self._tree.Bind(wx.EVT_MOVE, self.OnTabChanged)
        # parent, action_registerer, , default_settings={'collapsed':True}

    def register_frame(self, parent=None):
        if parent:
            self._parent = parent

            if self._mgr.GetPane("tree_content") in self._mgr._panes:
                register = self._mgr.InsertPane
            else:
                register = self._mgr.AddPane

            register(
                self._tree,
                wx.lib.agw.aui.AuiPaneInfo().Name("tree_content").Caption(
                    "Test Suites").LeftDockable(True).CloseButton(True))

            self._mgr.Update()
            # print(f"DEBUG: TreePlugin frame {self._parent.GetTitle()} tree {self._tree.GetName()}")

    def enable(self):
        self.register_action(
            ActionInfo('View',
                       'View Test Suites Explorer',
                       self.OnShowTree,
                       shortcut='F12',
                       doc='Show Test Suites tree panel',
                       position=1))
        self.subscribe(self.OnTreeSelection, RideTreeSelection)
        # self.save_setting('opened', True)
        if self.opened:
            self.OnShowTree(None)
        # print(f"DEBUG: TreePlugin end enable  tree focused? {self.is_focused()}")
        # self.subscribe(self.OnTabChanged, RideNotebookTabChanged)
        # self.subscribe(self._update_preview, RideTestCaseAdded)
        # self.subscribe(self._update_preview, RideUserKeywordAdded)
        # self.add_self_as_tree_aware_plugin()

    def close_tree(self):
        self._mgr.DetachPane(self._tree)
        self._tree.Hide()
        self._mgr.Update()
        self.save_setting('opened', False)
        # print(f"DEBUG: TreePlugin Called close")

    def disable(self):
        self.close_tree()
        # self.save_setting('opened', False)
        self.unsubscribe_all()
        self.unregister_actions()

    def is_focused(self):
        return self._tree.HasFocus()

    def populate(self, model):
        if model and model != self._model:
            self._model = model
        # print(f"DEBUG: Populating model... {self._model}\n\n")
        self._tree.populate(self._model)

    def set_editor(self, editor):
        self._tree.set_editor(editor)

    def OnShowTree(self, event):
        if not self._parent:
            self._parent = self.frame
        if not self._tree:  # This is not needed because tree is always created
            self._tree = Tree(self, self._parent.actions,
                              self._parent._application.settings)
            print(
                f"DEBUG: TreePlugin Show created tree {self._tree.GetName()}")

        # print(f"DEBUG: Tree OnShowTree event {event}")
        self._pane = self._mgr.GetPane(self._tree)
        HTML_BACKGROUND = self.settings.get('background help', (240, 242, 80))
        HTML_FOREGROUND = self.settings.get('foreground text', (7, 0, 70))
        HTML_FONT_FACE = self.settings.get('font face', '')
        HTML_FONT_SIZE = self.settings.get('font size', 11)
        self._tree.Show(True)
        self._tree.SetMinSize(wx.Size(200, 225))
        self._mgr.DetachPane(self._tree)
        # self._mgr.Update()
        self._mgr.AddPane(
            self._tree,
            wx.lib.agw.aui.AuiPaneInfo().Name("tree_content").Caption(
                "Test Suites").LeftDockable(True).CloseButton(True))
        self._tree.SetBackgroundStyle(wx.BG_STYLE_SYSTEM)
        self._tree.SetBackgroundColour(HTML_BACKGROUND)
        self._tree.SetForegroundColour(HTML_FOREGROUND)
        """
        self.font = self._tree.GetFont()
        # print(f"DEBUG:font {self.font}, face {HTML_FONT_FACE} size {HTML_FONT_SIZE}")
        if HTML_FONT_FACE is not None:
            self.font.SetFaceName(HTML_FONT_FACE)
            self.font.SetPointSize(HTML_FONT_SIZE)
            self._tree.SetFont(self.font)
            self._tree.Refresh()
        """
        self._tree.Raise()
        self._mgr.Update()
        self.save_setting('opened', True)
        if self._model:
            self._tree.populate(self._model)
            # print(f"DEBUG: model {self._model}")
        self._update_tree()

    def OnTreeSelection(self, message):
        if self.is_focused():
            self._tree.tree_node_selected(message.item)

    def OnTabChanged(self, event):
        # print(f"DEBUG: Called OnTabChanged")
        self._update_tree()
        # print(f"DEBUG: Called Tree._refresh_view {self._tree.GetParent().GetClassName()}")

    def _update_tree(self, event=None):
        # if self._tree.is_focused():
        #print(f"DEBUG: Populating model... {self._model}\n\n")
        #self.populate(self._model)
        self._tree.populate(self._model)
        self._tree._refresh_view()
Exemplo n.º 6
0
class TreePlugin(Plugin):
    """Provides a tree view for Test Suites """
    datafile = property(lambda self: self.get_selected_datafile())
    defaults = {"opened": True, "docked": True}

    def __init__(self, application):
        Plugin.__init__(self, application, default_settings=self.defaults)
        self.settings = application.settings._config_obj['Plugins']['Tree']
        self._parent = None
        self._tree = self.tree
        self._mgr = GetManager(self._tree)
        """
        self._action_registerer = action_registerer
        self.tree = parent.tree
        """
        # parent, action_registerer, , default_settings={'collapsed':True}
    def register_frame(self, parent=None):
        if parent:
            self._parent = parent
            self._mgr.InsertPane(
                self._tree,
                wx.lib.agw.aui.AuiPaneInfo().Name("tree_content").Caption(
                    "Test Suites").LeftDockable(True).CloseButton(True))
            self._mgr.Update()
            # print(f"DEBUG: TreePlugin frame {self._parent.GetTitle()} tree {self._tree.GetName()}")

    def enable(self):
        self.register_action(
            ActionInfo('View',
                       'View Test Suites Explorer',
                       self.OnShowTree,
                       shortcut='F12',
                       doc='Show Test Suites tree panel',
                       position=1))
        self.subscribe(self.OnTreeSelection, RideTreeSelection)
        # self.save_setting('opened', True)
        if self.opened:
            self.OnShowTree(None)
        # print(f"DEBUG: TreePlugin end enable  tree focused? {self.is_focused()}")
        # self.subscribe(self.OnTabChanged, RideNotebookTabChanged)
        # self.subscribe(self._update_preview, RideTestCaseAdded)
        # self.subscribe(self._update_preview, RideUserKeywordAdded)
        # self.add_self_as_tree_aware_plugin()

    def close_tree(self):
        self._mgr.DetachPane(self._tree)
        self._tree.Hide()
        self._mgr.Update()
        self.save_setting('opened', False)
        # print(f"DEBUG: TreePlugin Called close")

    def disable(self):
        self.close_tree()
        # self.save_setting('opened', False)
        self.unsubscribe_all()
        self.unregister_actions()

    def is_focused(self):
        return self._tree.HasFocus()

    def populate(self, model):
        self._tree.populate(model)

    def set_editor(self, editor):
        self._tree.set_editor(editor)

    def OnShowTree(self, event):
        if not self._parent:
            self._parent = self.frame
        if not self._tree:  # This is not needed because tree is always created
            self._tree = Tree(self, self._parent.actions,
                              self._parent._application.settings)
            print(
                f"DEBUG: TreePlugin Show created tree {self._tree.GetName()}")

        self._pane = self._mgr.GetPane(self._tree)
        self._tree.Show(True)
        self._mgr.DetachPane(self._tree)
        # self._mgr.Update()
        self._mgr.AddPane(
            self._tree,
            wx.lib.agw.aui.AuiPaneInfo().Name("tree_content").Caption(
                "Test Suites").LeftDockable(True).CloseButton(True))
        self._tree.Raise()
        self._mgr.Update()
        self.save_setting('opened', True)
        self._update_tree()

    def OnTreeSelection(self, event):
        if self._tree.is_focused():
            self._tree.tree_node_selected(event.item)

    def OnTabChanged(self, event):
        self._update_tree()

    def _update_tree(self, event=None):
        # if self._tree.is_focused():
        self._tree._refresh_view()
Exemplo n.º 7
0
class FileExplorerPlugin(Plugin):
    """Provides a tree view for Files and Folders. Opens selected item with mouse right-click."""
    datafile = property(lambda self: self.get_selected_datafile())
    defaults = {"opened": True, "docked": True}

    def __init__(self, application, controller=None):
        Plugin.__init__(self, application, default_settings=self.defaults)
        self.settings = application.settings._config_obj['Plugins'][
            'File Explorer']
        self._parent = None
        self._filemgr = self.filemgr
        self._filemgr.SetThemeEnabled(True)
        self._mgr = GetManager(self._filemgr)
        self._controller = controller

    def register_frame(self, parent=None):
        if parent:
            self._parent = parent
            self._mgr.InsertPane(
                self._filemgr,
                wx.lib.agw.aui.AuiPaneInfo().Name("file_manager").Caption(
                    "Files").LeftDockable(True).CloseButton(True))
            self._mgr.Update()

    def enable(self):
        self.register_action(
            ActionInfo('View',
                       'View File Explorer',
                       self.OnShowFileExplorer,
                       shortcut='F11',
                       doc='Show File Explorer panel',
                       position=1))
        # self.save_setting('opened', True)
        if self.opened:
            self.OnShowFileExplorer(None)

    def close_tree(self):
        self._mgr.DetachPane(self._filemgr)
        self._filemgr.Hide()
        self._mgr.Update()
        self.save_setting('opened', False)

    def disable(self):
        self.close_tree()
        # self.save_setting('opened', False)
        self.unsubscribe_all()
        self.unregister_actions()

    def is_focused(self):
        return self._filemgr.HasFocus()

    def OnShowFileExplorer(self, event):
        if not self._parent:
            self._parent = self.frame
        if not self._filemgr:  # This is not needed because file explorer is always created
            self._filemgr = FileExplorer(self._parent, self._controller)

        self._pane = self._mgr.GetPane(self._filemgr)
        self._filemgr.Show(True)
        self._mgr.DetachPane(self._filemgr)
        self._mgr.AddPane(
            self.filemgr,
            wx.lib.agw.aui.AuiPaneInfo().Name("file_manager").Caption(
                "Files").LeftDockable(True).CloseButton(True))
        self._filemgr.Raise()
        self._mgr.Update()
        self.save_setting('opened', True)
        self._update_tree()

    def _update_tree(self):
        if not self._filemgr:
            return
        self._filemgr.update_tree()
Exemplo n.º 8
0
class FileExplorerPlugin(Plugin):
    """Provides a tree view for Files and Folders. Opens selected item with mouse right-click."""
    datafile = property(lambda self: self.get_selected_datafile())
    defaults = {"opened": True, "docked": True}

    def __init__(self, application, controller=None):
        Plugin.__init__(self, application, default_settings=self.defaults)
        self.settings = application.settings._config_obj['Plugins'][
            'File Explorer']
        self._parent = wx.App.Get().GetTopWindow()
        self._filemgr = self.filemgr
        self._filemgr.SetThemeEnabled(True)
        self._mgr = GetManager(self._filemgr)
        self._controller = controller

    def register_frame(self, parent=None):
        if parent:
            self._parent = parent

            if self._mgr.GetPane("file_manager") in self._mgr._panes:
                register = self._mgr.InsertPane
            else:
                register = self._mgr.AddPane

            register(
                self._filemgr,
                wx.lib.agw.aui.AuiPaneInfo().Name("file_manager").Caption(
                    "Files").LeftDockable(True).CloseButton(True))

            self._mgr.Update()

    def enable(self):
        self.register_action(
            ActionInfo('View',
                       'View File Explorer',
                       self.OnShowFileExplorer,
                       shortcut='F11',
                       doc='Show File Explorer panel',
                       position=1))
        # self.save_setting('opened', True)
        if self.opened:
            self.OnShowFileExplorer(None)

    def close_tree(self):
        self._mgr.DetachPane(self._filemgr)
        self._filemgr.Hide()
        self._mgr.Update()
        self.save_setting('opened', False)

    def disable(self):
        self.close_tree()
        # self.save_setting('opened', False)
        self.unsubscribe_all()
        self.unregister_actions()

    def is_focused(self):
        return self._filemgr.HasFocus()

    def OnShowFileExplorer(self, event):
        if not self._parent:
            self._parent = wx.App.Get().GetWindow()  # self.frame
        if not self._filemgr:  # This is not needed because file explorer is always created
            self._filemgr = FileExplorer(self._parent, self._controller)

        self._pane = self._mgr.GetPane(self._filemgr)
        HTML_BACKGROUND = self.settings.get('background help', (240, 242, 80))
        HTML_FOREGROUND = self.settings.get('foreground text', (7, 0, 70))
        HTML_FONT_FACE = self.settings.get('font face', '')
        HTML_FONT_SIZE = self.settings.get('font size', 11)
        self._filetreectrl = self._filemgr.GetTreeCtrl()
        self._filemgr.Show(True)
        self._filemgr.SetMinSize(wx.Size(200, 225))
        self._mgr.DetachPane(self._filemgr)
        self._mgr.AddPane(
            self.filemgr,
            wx.lib.agw.aui.AuiPaneInfo().Name("file_manager").Caption(
                "Files").LeftDockable(True).CloseButton(True))
        self._filemgr.SetBackgroundStyle(wx.BG_STYLE_SYSTEM)
        self._filemgr.SetBackgroundColour(HTML_BACKGROUND)
        self._filemgr.SetForegroundColour(HTML_FOREGROUND)
        self.font = self._filemgr.GetFont()
        self.font.SetFaceName(HTML_FONT_FACE)
        self.font.SetPointSize(HTML_FONT_SIZE)
        self._filemgr.SetFont(self.font)
        self._filemgr.Refresh()
        self._filetreectrl.SetBackgroundColour(HTML_BACKGROUND)
        self._filetreectrl.SetForegroundColour(HTML_FOREGROUND)
        self._filetreectrl.SetFont(self.font)
        self._filetreectrl.Refresh()
        self._filemgr.Raise()
        self._mgr.Update()
        self.save_setting('opened', True)
        self._update_tree()

    def _update_tree(self):
        if not self._filemgr:
            return
        self._filemgr.update_tree()