示例#1
0
 def async_window(self, connection, **kwargs):
     directory = os.path.dirname(kwargs["guiPath"])
     name = os.path.basename(kwargs["guiPath"])
     dialogClass = self.loadDialogClass(name, directory)
     instance, instanceId = self.createDialogInstance(dialogClass, self.application().currentWindow(), async = True)
     if "parameters" in kwargs and kwargs["parameters"]:
         instance.setParameters(plist.readPlistFromString(kwargs["parameters"]))
     instance.show()
     self.sendResult(connection, instanceId)
示例#2
0
 def modal_window(self, connection, **kwargs):
     parameters = plist.readPlistFromString(kwargs["parameters"])
     directory = os.path.dirname(kwargs["guiPath"])
     name = os.path.basename(kwargs["guiPath"])
     dialogClass = self.loadDialogClass(name, directory)
     instance = self.createDialogInstance(dialogClass, self.application().currentWindow())
     instance.setParameters(parameters)
     value = instance.execModal()
     self.sendResult(connection, {"result": value})
示例#3
0
 def test_readPlistFromString(self):
     data = {
         "dict": {}, 
         "int":1, 
         "str": "hello world", 
         "list_of_ints": [1,2,3,4,5],
         "list_of_str": "hello world of prymatex".split()
         }
     string = plist.writePlistToString(data)
     self.assertEqual(plist.readPlistFromString(string), data)
示例#4
0
文件: server.py 项目: D3f0/prymatex
 def menu(self, **kwargs):
     parameters = plist.readPlistFromString(kwargs["parameters"])
     def sendSelectedIndex(index):
         if index != -1:
             self.sendResult({"selectedIndex": index})
         else:
             self.sendResult({})
         
     if "menuItems" in parameters:
         self.application.currentEditor().showFlatPopupMenu(parameters["menuItems"], sendSelectedIndex)
示例#5
0
    def menu(self, connection, **kwargs):
        parameters = plist.readPlistFromString(kwargs["parameters"])
        def sendSelectedIndex(connection):
            def _send(index):
                if index != -1:
                    self.sendResult(connection, {"selectedIndex": index})
                else:
                    self.sendResult(connection, {})
            return _send

        if "menuItems" in parameters:
            self.application().currentWindow().currentEditor().showFlatPopupMenu(parameters["menuItems"], sendSelectedIndex(connection))
示例#6
0
文件: server.py 项目: D3f0/prymatex
 def popup(self, **kwargs):
     suggestions = plist.readPlistFromString(kwargs["suggestions"])
     if kwargs.get("returnChoice", False):
         def sendSelectedSuggestion(suggestion):
             if suggestion is not None:
                 self.sendResult(suggestion)
             else:
                 self.sendResult({})
         self.application.currentEditor().runCompleter( suggestions = suggestions["suggestions"], 
                                                     already_typed = kwargs.get("alreadyTyped"), 
                                                     case_insensitive = kwargs.get("caseInsensitive", True),
                                                     callback = sendSelectedSuggestion)
     else:
         self.application.currentEditor().runCompleter( suggestions = suggestions["suggestions"], 
                                                     already_typed = kwargs.get("alreadyTyped"), 
                                                     case_insensitive = kwargs.get("caseInsensitive", True))
         self.sendResult()
示例#7
0
 def update_window(self, connection, **kwargs):
     parameters = plist.readPlistFromString(kwargs["parameters"])
     instance = self.dialogInstance(int(kwargs["token"]))
     instance.setParameters(parameters)
     self.sendResult(connection)
示例#8
0
 def images(self, connection, parameters = ""):
     data = plist.readPlistFromString(parameters)
     for name, path in data["register"].items():
         resources.set_resource("External", name, path)
     self.sendResult(connection)
示例#9
0
文件: server.py 项目: D3f0/prymatex
 def images(self, parameters = ""):
     data = plist.readPlistFromString(parameters)
     for name, path in data["register"].items():
         resources.registerImagePath(name, path)
     self.sendResult()