def __init__(self, parent, settings):
        """
        Constructor
        """
        self.dashboardFrame = None
        self.parent = None
        self.treevw = None
        self.style = None
        self.ips = None
        self.ports = None
        self.tools = None

        iconPath = Utils.getIconDir()
        self.icons = {}
        self.icons["tool"] = ImageTk.PhotoImage(
            Image.open(iconPath + "tool.png"))
        self.icons["cross"] = ImageTk.PhotoImage(
            Image.open(iconPath + "cross.png"))
        self.icons["running"] = ImageTk.PhotoImage(
            Image.open(iconPath + "running.png"))
        self.icons["done"] = ImageTk.PhotoImage(
            Image.open(iconPath + "done_tool.png"))
        self.icons["ready"] = ImageTk.PhotoImage(
            Image.open(iconPath + "waiting.png"))
        self.icons["Not ready"] = ImageTk.PhotoImage(
            Image.open(iconPath + "cross.png"))
Example #2
0
 def initModules(self):
     discovered_plugins = {
         name: importlib.import_module(name)
         for finder, name, ispkg
         in iter_namespace(core.Components.Modules)
     }
     self.modules = []
     for name, module in discovered_plugins.items():
         module_class = getattr(module, name.split(".")[-1])
         module_obj = module_class(self.parent, self.settings)
         self.modules.append({"name": module_obj.tabName, "object":module_obj, "view":None, "img":ImageTk.PhotoImage(Image.open(Utils.getIconDir()+module_obj.iconName))})
Example #3
0
    def __init__(self, parent):
        """
        Initialise the application

        Args:
            parent: The main tk window.
        """
        # Lexic:
        # view frame : the frame in the tab that will hold forms.
        # Tree view : the tree on the left of the window.
        # frame tree view : a frame around the tree view (useful to attach a scrollbar to a treeview)
        # canvas : a canvas object (useful to attach a scrollbar to a frame)
        # paned : a Paned widget is used to separate two other widgets and display a one over the other if desired
        #           Used to separate the treeview frame and view frame.
        
        self.parent = parent  #  parent tkinter window
        #  already read notifications from previous notification reading iteration
        self.old_notifs = []
        self.notifications_timers = None
        tk.Tk.report_callback_exception = self.show_error
        self.setStyle()
        # HISTORY : Main view and command where historically in the same view;
        # This results in lots of widget here with a confusing naming style
        ttk.Frame.__init__(self, parent)
        #### core components (Tab menu on the left objects)####
        self.settings = Settings()
        self.settingViewFrame = None
        self.scanManager = None  #  Loaded when clicking on it if linux only
        self.scanViewFrame = None
        self.main_tab_img = ImageTk.PhotoImage(
            Image.open(Utils.getIconDir()+"tab_main.png"))
        self.commands_tab_img = ImageTk.PhotoImage(
            Image.open(Utils.getIconDir()+"tab_commands.png"))
        self.scan_tab_img = ImageTk.PhotoImage(
            Image.open(Utils.getIconDir()+"tab_scan.png"))
        self.settings_tab_img = ImageTk.PhotoImage(
            Image.open(Utils.getIconDir()+"tab_settings.png"))
        self.initModules()

        #### MAIN VIEW ####
        self.openedViewFrameId = None
        self.mainPageFrame = None
        self.paned = None
        self.canvasMain = None
        self.viewframe = None
        self.frameTw = None
        self.treevw = None
        self.myscrollbarMain = None
        #### COMMAND VIEW ####
        self.commandsPageFrame = None
        self.commandPaned = None
        self.commandsFrameTw = None
        self.canvas = None
        self.commandsViewFrame = None
        self.myscrollbarCommand = None
        self.commandsTreevw = None
        #### SEARCH BAR ####
        # boolean set to true when the main tree view is displaying search results
        self.searchMode = False
        self.searchBar = None  # the search bar component
        self.btnHelp = None  # help button on the right of the search bar
        self.photo = None  # the ? image
        self.helpFrame = None  # the floating help frame poping when the button is pressed

        # Connect to database and choose database to open
        abandon = False
        mongoInstance = MongoCalendar.getInstance()
        while not mongoInstance.isUserConnected() and not abandon:
            abandon = self.promptForConnection() is None
        if not abandon:
            mongoInstance.attach(self)
            self.initUI()
            # Will trigger promptForCalendarOpen when tab will be opened
        else:
            self.onClosing()
            try:
                parent.destroy()
            except tk.TclError:
                pass