# Path: message_box.py
# class MessageBox(Popup):
#     text = StringProperty('')
#     cb = ObjectProperty()
# 
#     ok_text = StringProperty('OK')
#     cancel_text = StringProperty('Cancel')
# 
#     def ok(self):
#         if self.cb:
#             self.cb(True)
#         self.dismiss()
# 
#     def cancel(self):
#         if self.cb:
#             self.cb(False)
#         self.dismiss()


    import wx
import threading
import os.path
import subprocess as sp
import time
from kivy.clock import mainthread
from message_box import MessageBox
    wx_available = True
except Exception:
    wx_available = False




class NativeFileChooser():
    type_name = 'wx'

    def __init__(self, **kwargs):
        super(NativeFileChooser, self).__init__(**kwargs)
        self.use_wx = False
        self.use_zenity = False
        self.use_kdialog = False
        self.failed = False

        if NativeFileChooser.type_name == 'wx' and wx_available:
            self.use_wx = True
        elif NativeFileChooser.type_name == 'zenity':
            self.use_zenity = True
        elif NativeFileChooser.type_name == 'kdialog':
            self.use_kdialog = True
        else:
            raise "Unknown chooser"

    def _run_command(self, cmd):
        self._process = sp.Popen(cmd, stdout=sp.PIPE)
        while True:
            ret = self._process.poll()

# Path: message_box.py
# class MessageBox(Popup):
#     text = StringProperty('')
#     cb = ObjectProperty()
# 
#     ok_text = StringProperty('OK')
#     cancel_text = StringProperty('Cancel')
# 
#     def ok(self):
#         if self.cb:
#             self.cb(True)
#         self.dismiss()
# 
#     def cancel(self):
#         if self.cb:
#             self.cb(False)
#         self.dismiss()


# Path: native_file_chooser.py
    import wx
import threading
import os.path
import subprocess as sp
import time
from kivy.clock import mainthread
from message_box import MessageBox

    wx_available = True
except Exception:
    wx_available = False




class NativeFileChooser():
    type_name = 'wx'

    def __init__(self, **kwargs):
        super(NativeFileChooser, self).__init__(**kwargs)
        self.use_wx = False
        self.use_zenity = False
        self.use_kdialog = False
        self.failed = False

        if NativeFileChooser.type_name == 'wx' and wx_available:
            self.use_wx = True
        elif NativeFileChooser.type_name == 'zenity':
            self.use_zenity = True
        elif NativeFileChooser.type_name == 'kdialog':
            self.use_kdialog = True
        else:
            raise "Unknown chooser"

    def _run_command(self, cmd):
        self._process = sp.Popen(cmd, stdout=sp.PIPE)
        while True:
            ret = self._process.poll()

            if ret is not None: