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
Beispiel #2
0
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
Beispiel #3
0
 def testReturnsNoExtensionDataIfNoExtensionDataGiven(self):
     helper = WildcardHelper("Text files", ["txt"])
     self.assertEquals(
         helper.get_extension_data("foo.txt"),
         None)
Beispiel #4
0
 def testReturnsNoExtensionDataIfPathDoesNotPathExtension(self):
     helper = WildcardHelper("Text files", [("txt", 4)])
     self.assertEquals(
         helper.get_extension_data("bar"),
         None)
Beispiel #5
0
 def testReturnsExtensionDataIfExtensionDataGivenAndPathMatch(self):
     helper = WildcardHelper("Image files", [("png", 1), ("bmp", 2)])
     self.assertEquals(
         helper.get_extension_data("bar.png"),
         1)
Beispiel #6
0
 def testReturnsNoExtensionDataIfNoExtensionDataGiven(self):
     helper = WildcardHelper("Text files", ["txt"])
     self.assertEquals(helper.get_extension_data("foo.txt"), None)
Beispiel #7
0
 def testReturnsNoExtensionDataIfPathDoesNotPathExtension(self):
     helper = WildcardHelper("Text files", [("txt", 4)])
     self.assertEquals(helper.get_extension_data("bar"), None)
Beispiel #8
0
 def testReturnsExtensionDataIfExtensionDataGivenAndPathMatch(self):
     helper = WildcardHelper("Image files", [("png", 1), ("bmp", 2)])
     self.assertEquals(helper.get_extension_data("bar.png"), 1)