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