def get_path(main_frame): image_type = None path = None file_info = _("export files") file_types = [("csv", "")] images_wildcard_helper = WildcardHelper(file_info, file_types) wildcard = images_wildcard_helper.wildcard_string() dialog = wx.FileDialog(main_frame, message=_("Export"), wildcard=wildcard, style=wx.FD_SAVE) if dialog.ShowModal() == wx.ID_OK: path = images_wildcard_helper.get_path(dialog) image_type = images_wildcard_helper.get_extension_data(path) dialog.Destroy() return path, image_type
def testReturnsNoExtensionDataIfNoExtensionDataGiven(self): helper = WildcardHelper("Text files", ["txt"]) self.assertEquals( helper.get_extension_data("foo.txt"), None)
def testReturnsNoExtensionDataIfPathDoesNotPathExtension(self): helper = WildcardHelper("Text files", [("txt", 4)]) self.assertEquals( helper.get_extension_data("bar"), None)
def testReturnsExtensionDataIfExtensionDataGivenAndPathMatch(self): helper = WildcardHelper("Image files", [("png", 1), ("bmp", 2)]) self.assertEquals( helper.get_extension_data("bar.png"), 1)
def testReturnsNoExtensionDataIfNoExtensionDataGiven(self): helper = WildcardHelper("Text files", ["txt"]) self.assertEquals(helper.get_extension_data("foo.txt"), None)
def testReturnsNoExtensionDataIfPathDoesNotPathExtension(self): helper = WildcardHelper("Text files", [("txt", 4)]) self.assertEquals(helper.get_extension_data("bar"), None)
def testReturnsExtensionDataIfExtensionDataGivenAndPathMatch(self): helper = WildcardHelper("Image files", [("png", 1), ("bmp", 2)]) self.assertEquals(helper.get_extension_data("bar.png"), 1)