Exemplo n.º 1
0
Arquivo: tree.py Projeto: Xeon2003/vi
    def handleInitialHash(self, pathList, params):
        assert self.canHandleInitialHash(pathList, params)

        if pathList[1] == "list":
            wdg = displayDelegateSelector.select(self.moduleName,
                                                 self.moduleInfo)
            assert wdg is not None, "Got no handler for %s" % self.moduleName
            self.addWidget(wdg(self.moduleName))
            self.focus()

        elif pathList[1] in ["edit", "clone"] and len(pathList) > 3:
            pane = Pane(translate("Edit"),
                        closeable=True,
                        iconClasses=[
                            "module_%s" % self.moduleName, "apptype_tree",
                            "action_edit"
                        ])
            edwg = EditWidget(self.moduleName,
                              EditWidget.appTree,
                              key=pathList[3],
                              skelType=pathList[2],
                              hashArgs=(params or None),
                              clone=pathList[1] == "clone")
            pane.addWidget(edwg)
            conf["mainWindow"].addPane(pane, parentPane=self)
            pane.focus()
Exemplo n.º 2
0
	def openEditor(self, key):
		pane = Pane(translate("Clone"), closeable=True, iconClasses=["modul_%s" % self.parent().parent().module, "apptype_list", "action_edit" ])
		conf["mainWindow"].stackPane( pane )
		edwg = EditWidget(self.parent().parent().module, EditWidget.appList, key=key, clone=True,
		                    context=self.parent().parent().context)
		pane.addWidget( edwg )
		pane.focus()
Exemplo n.º 3
0
    def onClick(self, sender=None):
        selection = self.parent().parent().getCurrentSelection()
        if not selection:
            return

        for s in selection:
            if isinstance(s, self.parent().parent().nodeWidget):
                i = html5.ext.InputDialog(translate("Directory Name"),
                                          successHandler=self.editDir,
                                          value=s.data["name"])
                i.dirKey = s.data["key"]
                return

            pane = Pane("Edit",
                        closeable=True,
                        iconClasses=[
                            "modul_%s" % self.parent().parent().module,
                            "apptype_tree", "action_edit"
                        ])
            conf["mainWindow"].stackPane(pane, focus=True)
            skelType = "leaf"
            edwg = EditWidget(self.parent().parent().module,
                              EditWidget.appTree,
                              key=s.data["key"],
                              skelType=skelType)
            pane.addWidget(edwg)
Exemplo n.º 4
0
 def openEditor(self, key):
     pane = Pane(translate("Edit"), closeable=True)
     conf["mainWindow"].stackPane(pane, focus=True)
     edwg = EditWidget(self.parent().parent().module,
                       EditWidget.appHierarchy,
                       key=key,
                       context=self.parent().parent().context)
     pane.addWidget(edwg)
Exemplo n.º 5
0
	def onEdit(self, *args, **kwargs):
		"""
			Edit the image entry.
		"""
		pane = Pane( translate("Edit"), closeable=True, iconClasses=[ "modul_%s" % self.parent.destModule,
		                                                                    "apptype_list", "action_edit" ] )
		conf["mainWindow"].stackPane( pane, focus=True )
		edwg = EditWidget( self.parent.destModule, EditWidget.appTree, key=self.data[ "key" ], skelType="leaf"  )
		pane.addWidget( edwg )
Exemplo n.º 6
0
 def openEditor(self, key):
     pane = Pane(translate("Recurrent Events"),
                 closeable=True,
                 iconClasses=[
                     "modul_%s" % self.parent().parent().module,
                     "apptype_list", "action_edit"
                 ])
     conf["mainWindow"].stackPane(pane)
     edwg = RepeatDatePopup(self.parent().parent().module, key=key)
     pane.addWidget(edwg)
     pane.focus()
Exemplo n.º 7
0
	def handleInitialHash(self, pathList, params):
		assert self.canHandleInitialHash(pathList, params)
		if pathList[1] == "list":
			self.addWidget(HierarchyWidget(self.moduleName))
			self.focus()
		elif pathList[1] in ["edit", "clone"] and len(pathList) > 2:
			pane = Pane(translate("Edit"), closeable=True,
			            iconClasses=["module_%s" % self.moduleName, "apptype_hierarchy", "action_edit"])
			edwg = EditWidget(self.moduleName, EditWidget.appHierarchy, key=pathList[2], hashArgs=(params or None), clone=pathList[1] == "clone")
			pane.addWidget(edwg)
			conf["mainWindow"].addPane(pane, parentPane=self)
			pane.focus()
Exemplo n.º 8
0
    def openModule(self, data, title=None):
        # Have a handler?
        widgen = moduleHandlerSelector.select(self.contextModule,
                                              self.adminInfo)
        assert widgen

        # Generate title
        if title is None:
            for key in ["name", "title"]:
                title = data.get(key)

                if title:
                    if isinstance(title,
                                  dict) and conf["currentlanguage"] in title:
                        title = title[conf["currentlanguage"]]

                    break

        # Merge contexts
        context = {}
        context.update(self.widget.context or {})
        context.update(self.adminInfo.get("context", {}))

        # Evaluate context variables
        for var in self.contextVariables:
            if "=" in var:
                key, value = var.split("=", 1)
                if value[0] == "$":
                    value = data.get(value[1:])
            else:
                key = var
                value = data.get("key")

            context[key] = value

        print(context)

        widget = widgen(self.contextModule, self.adminInfo, context)

        if widget:
            pane = Pane(translate(u"{module} - {name}",
                                  module=self.title,
                                  name=title),
                        closeable=True,
                        iconURL=self.icon,
                        iconClasses=["module_%s" % self.contextModule])
            conf["mainWindow"].stackPane(pane)

            pane.addWidget(widget)
            pane.focus()
        else:
            print("Widget could not be generated")
Exemplo n.º 9
0
	def onSelectionActivated(self, table, selection ):
		if not self.parent().parent().selectMode and len(selection)==1:
			pane = Pane( translate("Edit"), closeable=True, iconClasses=["modul_%s" % self.parent().parent().module, "apptype_tree", "action_edit" ])
			conf["mainWindow"].stackPane( pane )
			if isinstance( selection[0], self.parent().parent().nodeWidget):
				skelType = "node"
			elif isinstance( selection[0], self.parent().parent().leafWidget):
				skelType = "leaf"
			else:
				raise ValueError("Unknown selection type: %s" % str(type(selection[0])))
			edwg = EditWidget( self.parent().parent().module, EditWidget.appTree, key=selection[0].data["key"], skelType=skelType)
			pane.addWidget( edwg )
			pane.focus()
Exemplo n.º 10
0
 def onClick(self, sender=None):
     pane = Pane(translate("Add"),
                 closeable=True,
                 iconClasses=[
                     "module_%s" % self.parent().parent().module,
                     "apptype_tree", "action_add_node"
                 ])
     conf["mainWindow"].stackPane(pane)
     edwg = EditWidget(self.parent().parent().module,
                       EditWidget.appTree,
                       node=self.parent().parent().node,
                       skelType="node")
     pane.addWidget(edwg)
     pane.focus()
Exemplo n.º 11
0
 def onClick(self, sender=None):
     pane = Pane(translate("Add"),
                 closeable=True,
                 iconClasses=[
                     "modul_%s" % self.parent().parent().module,
                     "apptype_hierarchy", "action_add"
                 ])
     conf["mainWindow"].stackPane(pane)
     edwg = EditWidget(self.parent().parent().module,
                       EditWidget.appHierarchy,
                       node=self.parent().parent().rootNode,
                       context=self.parent().parent().context)
     pane.addWidget(edwg)
     pane.focus()
Exemplo n.º 12
0
    def onClick(self, sender=None):
        pane = Pane("Add",
                    closeable=True,
                    iconClasses=[
                        "module_%s" % self.parent().parent().module,
                        "apptype_tree", "action_add_leaf"
                    ])
        conf["mainWindow"].stackPane(pane)
        edwg = EditWidget(self.parent().parent().module,
                          EditWidget.appTree,
                          node=self.parent().parent().node,
                          skelType="leaf",
                          context={"kind": "link"})

        pane.addWidget(edwg)
        pane.focus()
Exemplo n.º 13
0
	def onClick(self, sender=None):
		selection = self.parent().parent().getCurrentSelection()
		if not selection:
			return
		print(selection)
		for s in selection:
			pane = Pane(translate("Edit"), closeable=True)
			conf["mainWindow"].stackPane( pane, focus=True )
			if isinstance(s,self.parent().parent().nodeWidget):
				skelType = "node"
			elif isinstance(s,self.parent().parent().leafWidget):
				skelType = "leaf"
			else:
				raise ValueError("Unknown selection type: %s" % str(type(s)))
			edwg = EditWidget( self.parent().parent().module, EditWidget.appTree, key=s.data["key"], skelType=skelType, iconClasses=["modul_%s" % self.parent().parent().module, "apptype_tree", "action_edit" ])
			pane.addWidget( edwg )
Exemplo n.º 14
0
    def edit(self, selection):
        for s in selection:
            pane = Pane(translate("Edit"), closeable=True)
            conf["mainWindow"].stackPane(pane, focus=True)

            print(s)
            print(s.skelType)

            edwg = EditWidget(self.parent().parent().module,
                              EditWidget.appTree,
                              key=s.data["key"],
                              skelType=s.skelType,
                              iconClasses=[
                                  "module_%s" % self.parent().parent().module,
                                  "apptype_tree", "action_edit"
                              ])
            pane.addWidget(edwg)
Exemplo n.º 15
0
    def onEdit(self, sender=None):
        pane = Pane(translate("Edit"),
                    closeable=True,
                    iconClasses=[
                        "module_%s" % self.relationalBone.destModule,
                        "apptype_list", "action_edit"
                    ])
        conf["mainWindow"].stackPane(pane, focus=True)

        try:
            edwg = EditWidget(self.relationalBone.destModule,
                              EditWidget.appList,
                              key=self.data["dest"]["key"],
                              context=self.relationalBone.context)
            pane.addWidget(edwg)

        except AssertionError:
            conf["mainWindow"].removePane(pane)
Exemplo n.º 16
0
 def onSelectionActivated(self, table, selection):
     if not self.parent().parent().isSelector and len(
             selection) == 1 and isinstance(
                 selection[0],
                 self.parent().parent().leafWidget):
         pane = Pane(translate("Edit"),
                     closeable=True,
                     iconClasses=[
                         "modul_%s" % self.parent().parent().module,
                         "apptype_tree", "action_edit"
                     ])
         conf["mainWindow"].stackPane(pane)
         skelType = "leaf"
         edwg = EditWidget(self.parent().parent().module,
                           EditWidget.appTree,
                           key=selection[0].data["key"],
                           skelType=skelType)
         pane.addWidget(edwg)
         pane.focus()
Exemplo n.º 17
0
Arquivo: file.py Projeto: Xeon2003/vi
    def onEdit(self, *args, **kwargs):
        """
			Edit the image.
		"""
        if not self.selection:
            return

        pane = Pane(translate("Edit"),
                    closeable=True,
                    iconClasses=[
                        "modul_%s" % self.destModule, "apptype_list",
                        "action_edit"
                    ])
        conf["mainWindow"].stackPane(pane, focus=True)

        try:
            edwg = EditWidget(self.destModule,
                              EditWidget.appTree,
                              key=self.selection["dest"]["key"],
                              skelType="leaf")
            pane.addWidget(edwg)
        except AssertionError:
            conf["mainWindow"].removePane(pane)