Example #1
0
def appendFilterGroup(ctx, smgr, filters, filterall, templateurl):	
	filterpairs = []
	[filterpairs.append(StringPair(First=key, Second=filters[key])) for key in sorted(filters.keys())]
	filepicker = smgr.createInstanceWithArgumentsAndContext("com.sun.star.ui.dialogs.FilePicker", (FILEOPEN_SIMPLE,), ctx)
	filepicker.setDisplayDirectory(templateurl)  # デフォルトで表示するフォルダを設定。設定しないと「最近開いたファイル」が表示される。
	filepicker.appendFilterGroup("Filters", filterpairs)
	filepicker.setCurrentFilter(filterall)  # デフォルトで表示するフィルターを設定。linuxBeanのFILESAVE系では「すべての形式」(*以外のフィルターの拡張子を足したもの)というのが表示されてしまう。
	return filepicker
Example #2
0
 def test_meta_field(self):
     id = StringPair("content.xml", self.mkname("id"))
     root = TreeNode()
     meta = MetaFieldNode(id)
     text = TextNode("abc")
     root.appendchild(TextNode("123"))
     meta.appendchild(text)
     root.appendchild(meta)
     self.dotest(root)
Example #3
0
    def test_infobar_remove(self):
        self.ui_test.create_doc_in_start_center("writer")
        controller = self.ui_test.get_component().getCurrentController()
        buttons = [StringPair("Close", ".uno:CloseDoc")]
        controller.appendInfobar(
            "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True)

        controller.removeInfobar("my")

        # Removing an already removed infobar should throw an exception
        with self.assertRaises(NoSuchElementException):
            controller.removeInfobar("my")
Example #4
0
    def test_infobar_add(self):
        self.ui_test.create_doc_in_start_center("writer")
        controller = self.ui_test.get_component().getCurrentController()
        buttons = [StringPair("Close", ".uno:CloseDoc")]
        controller.appendInfobar(
            "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True)

        # Adding another infobar with the same ID should throw an exception
        with self.assertRaises(IllegalArgumentException):
            controller.appendInfobar(
                "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True)
        self.ui_test.close_doc()
Example #5
0
 def serializeNode(self, node):
     xBuffer = self.root.xmsf.createInstance("com.sun.star.io.Pipe")
     xTextInputStream = self.root.xmsf.createInstance(
         "com.sun.star.io.TextInputStream")
     xSaxWriter = self.root.xmsf.createInstance(
         "com.sun.star.xml.sax.Writer")
     xSaxWriter.setOutputStream(xBuffer)
     xTextInputStream.setInputStream(xBuffer)
     node.serialize(xSaxWriter, tuple([StringPair()]))
     result = ""
     while (not xTextInputStream.isEOF()):
         sLine = xTextInputStream.readLine()
         if (not sLine == "") and (not sLine.startswith("<?xml")):
             result = result + sLine + "\n"
Example #6
0
    def test_infobar_update(self):
        self.ui_test.create_doc_in_start_center("writer")
        controller = self.ui_test.get_component().getCurrentController()
        buttons = [StringPair("Close", ".uno:CloseDoc")]
        controller.appendInfobar(
            "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True)
        controller.updateInfobar("my", "Hello universe", "", InfobarType.WARNING)

        # Updating non-existing infobars should throw an exception
        with self.assertRaises(NoSuchElementException):
            controller.updateInfobar("notexisting", "", "", InfobarType.WARNING)

        # Passing invalid values for InfobarType should throw an exception
        with self.assertRaises(IllegalArgumentException):
            controller.updateInfobar("my", "", "", 120)
Example #7
0
 def __init__(self, name, xmlid=StringPair()):
     super().__init__(name, xmlid)
     self.ispoint = False
     self.isstart = False
Example #8
0
 def __init__(self, name, xmlid=StringPair()):
     super().__init__(name)
     self.xmlid = xmlid
     self.nodetype = "Bookmark"
Example #9
0
 def mkid_(self, id):
     return StringPair("content.xml", id)
Example #10
0
 def mkid(self, prefix):
     id = self.mkname(prefix)
     return StringPair("content.xml", self.mkname(prefix))
Example #11
0
 def test_meta_field_empty(self):
     id = StringPair("content.xml", self.mkname("id"))
     root = TreeNode()
     meta = MetaFieldNode(id)
     root.appendchild(meta)
     self.dotest(root)
Example #12
0
 def streamStartedHandler(self, parent):
     parent.tfCompleted = False
     parent.node.serialize(parent.xSaxWriter, tuple([StringPair()]))