Beispiel #1
0
 def refreshAddManualobjectPanel(self):
     for widget in self.scrollable_frame.winfo_children():
         widget.destroy()
     if len(self.attributeTree.get_children()) > 0:
         currItem = self.attributeTree.focus()
         Util.focusTree(self.attributeTree, currItem)
     else:
         self.addObjectIndentificationFields(self.attributeTree,
                                             self.scrollable_frame)
Beispiel #2
0
 def __init__(self,root=None):
     self.CONFIG_PATH=os.path.abspath(Util.get_correct_path('../Resources/Settings.ini'))
     self.root=root 
     self.config=None 
     self.configDict={} 
     self.configuration=self.CONFIG_PATH 
     self.settingWindow=None
Beispiel #3
0
 def AddManualobjectToTree(self, treeManual, objtype=None):
     if (treeManual.grid_slaves(
             0, 1)[0]).get() == '' or (treeManual.grid_slaves(
                 0, 1)[0]).get() == None or (treeManual.grid_slaves(
                     1, 1)[0]).get() == '' or (treeManual.grid_slaves(
                         1, 1)[0]).get() == None:
         messagebox.showinfo(
             'Object Not Created',
             'Please provide Object Name and at least one property to add object.'
         )
     else:
         if objtype == 'child':
             currentItem = self.attributeTree.focus()
             currParentObj = self.ObjectPropertyTree.objectDict[currentItem]
             currObj = self.ObjectPropertyTree.createTreeObject(
                 currParentObj)[1]
         else:
             self.ObjectPropertyTree = TreeProcessor.ObjectPropertyTree(
                 self.attributeTree, treevals=treeManual)
             currObj = self.ObjectPropertyTree.createTreeObject()[1]
         Util.focusTree(self.attributeTree, currObj.ObjectID)
Beispiel #4
0
 def createPOMTree(self, processType=None):
     if self.tree != None:
         self.tree.destroy()
     self.tree = Util.scrollableTree(self.treeFrame, 'both')
     self.tree.heading('#0', anchor='w')
     self.tree.grid(row=0, column=0, sticky="nsew")
     if self.POMTreeView == None:
         print('IT IS NULL')
     self.POMTreeView.setTree(self.tree)
     if self.XML.filePath != None:
         self.POMTreeView.createTree(self.XML, self.tree, processType)
     self.tree.bind("<<TreeviewSelect>>",
                    lambda event: self.displayObjectProperties(event))
Beispiel #5
0
    def updatePOMTree(self, propertyWindow, objDict, actionType=None):
        currItem = self.attributeTree.focus()
        objectToAdd = objDict[currItem]
        currObject = objectToAdd
        addToObject = ''
        objList = [currObject.ObjectID]
        if self.tree == None:
            self.createPOMTree()
        propertyWindow.attributes('-topmost', False)
        if self.tree.exists(currObject.ObjectID):
            messagebox.showinfo(
                'Object Present with ID: =' + currObject.ObjectID,
                'Object Present with ID: ' + currObject.ObjectID +
                '. \nPlease Change the Name or Update object Directly from Attribute Window'
            )
        else:
            self.POMTreeView.treeDict[currObject.ObjectID] = currObject
            while currObject.ParentID != None and len(currObject.ParentID) > 0:
                if self.tree.exists(currObject.ParentID):
                    addToObject = currObject.ParentID
                    self.POMTreeView.treeDict[addToObject].childList.append(
                        currObject)
                    break
                else:
                    currObject = objDict[currObject.ParentID]
                    self.POMTreeView.treeDict[currObject.ObjectID] = currObject
                    objList.insert(0, currObject.ObjectID)

        for childtree in objList:
            childObj = objDict[childtree]
            self.tree.insert(addToObject,
                             'end',
                             iid=childObj.ObjectID,
                             text=childObj.DisplayName)
            addToObject = childObj.ObjectID
        propertyWindow.destroy()
        Util.focusTree(self.tree, objectToAdd.ObjectID)
        print('Object to Focus :' + currObject.ObjectID)
Beispiel #6
0
 def createAttributeTree(self, attrsList, processType=None):
     self.attributeTree = ttk.Treeview(self.attributeTreeFrame)
     self.yscrollbar = Util.AutoScrollbar(self.attributeTreeFrame,
                                          orient='vertical',
                                          command=self.attributeTree.yview)
     self.attributeTree.configure(yscrollcommand=self.yscrollbar.set)
     self.attributeTree.grid(row=0, column=0, sticky='nsew')
     self.yscrollbar.grid(row=0, column=1, sticky='ns')
     self.ObjectPropertyTree = TreeProcessor.ObjectPropertyTree(
         self.attributeTree, attrsList, processtype=processType)
     self.attributeTree.bind(
         "<<TreeviewSelect>>", lambda event: self.displayProperties(
             self.attributetreeValues,
             self.ObjectPropertyTree.getObjectDict()))
Beispiel #7
0
    def addobjectPropertiesManually(self):
        self.attributePanelWindow = Toplevel()
        self.attributePanelWindow.geometry("600x500")
        self.attributePanelWindow.attributes('-topmost', True)
        self.attributePanelWindow.title("Object Properties")
        self.attributePanelWindow.grid_columnconfigure(0, weight=1)
        self.attributePanelWindow.grid_rowconfigure(0, weight=1)
        top = ttk.Frame(self.attributePanelWindow)
        top.grid(column=0, row=0, sticky='nsew')
        top.grid_columnconfigure(0, weight=1, uniform="group1")
        top.grid_columnconfigure(1, weight=1, uniform="group1")
        top.grid_rowconfigure(0, weight=1)
        self.attributeTreeFrame = Frame(top, borderwidth=1, relief="solid")
        self.attributetreeValues = Frame(top, borderwidth=1, relief="solid")
        self.attributeTreeFrame.grid_rowconfigure(0, weight=1)
        self.attributeTreeFrame.grid_columnconfigure(0, weight=1)
        self.attributeTreeFrame.grid(row=0, column=0, sticky='nsew')
        self.attributetreeValues.grid_rowconfigure(0, weight=1)
        self.attributetreeValues.grid_columnconfigure(0, weight=1)
        self.attributetreeValues.grid(row=0, column=1, sticky='nsew')
        self.scrollable_frame = Util.ScrollableFrame(self.attributetreeValues,
                                                     'both')

        self.attributeTree = ttk.Treeview(self.attributeTreeFrame)
        self.attributeTree.grid(row=0, column=0, sticky="nsew")
        self.attributeTree.bind(
            "<<TreeviewSelect>>", lambda event: self.displayProperties(
                self.scrollable_frame, self.ObjectPropertyTree.getObjectDict(),
                'manual'))
        footer = ttk.Frame(top, height=120)
        footer.grid(column=0, row=1, columnspan=2)
        ttk.Button(footer,
                   text='Cancel',
                   command=self.attributePanelWindow.destroy).grid(column=0,
                                                                   row=1,
                                                                   padx=5,
                                                                   pady=10)
        ttk.Button(footer,
                   text='Add Object',
                   command=lambda: self.updatePOMTree(
                       self.attributePanelWindow,
                       self.ObjectPropertyTree.getObjectDict())).grid(column=1,
                                                                      row=1,
                                                                      padx=5,
                                                                      pady=10)
        self.addObjectIndentificationFields(self.attributeTree,
                                            self.scrollable_frame)
Beispiel #8
0
 def updateObjectProperty(self, actionType=None):
     currObj = self.POMTreeView.updateObjectProperty(
         self.tree, self.treeValues, self.currentItem)
     self.currentItem = currObj.ObjectID
     Util.focusTree(self.tree, currObj.ObjectID)
     self.displayObjectProperties()