"""

    Dialogs for FontLab < 5.1. 
    
    This one should be loaded for various platforms, using dialogKit
    http://www.robofab.org/tools/dialogs.html
    
"""

from FL import *
from dialogKit import ModalDialog, Button, TextBox, EditText

__all__ = [
    "AskString",
    "AskYesNoCancel",
    #"FindGlyph",
    "GetFile",
    "GetFolder",
    "Message",
    "OneList",
    "PutFile",
    #"SearchList",
    #"SelectFont",
    #"SelectGlyph",
    #"TwoChecks",
    #"TwoFields",
    "ProgressBar",
]


def AskString(prompt, value='', title='RoboFab'):
    dialogInstance = _AskStringDialog(prompt, value, title)
    return dialogInstance.getValue()

class _AskStringDialog(object):
    def __init__(self, prompt, value, title):
        self.w = ModalDialog((360, 140), title)
        self.w.button1 = Button((-100, -300, 80, 24), 'OK', callback=self.buttonCallback)
        self.w.t = TextBox((5, 10, -5, 27), prompt)
        self.w.inputValue = EditText((5, 35, -5, 50), value)
        self.w.open()
    
    def getValue(self):
        return self.w.inputValue.get()
    
    def buttonCallback(self, sender):
        self.w.close()

def AskYesNoCancel(prompt, title='RoboFab', default=1):
    dialogInstance = _AskYesNoCancelDialog(prompt, title=title, default=default)
    result = dialogInstance.getValue()
    if result is None and default is not None:
        return default
    return result

class _AskYesNoCancelDialog(object):
    def __init__(self, prompt, default=None, title="RoboFab"):
        # default is ignord?
        self.answer = -1
        self.w = ModalDialog((360, 140), title, okCallback=self.buttonOKCallback)
        self.w.noButton = Button((10, -35, 80, 24), 'No', callback=self.buttonNoCallback)
        self.w.t = TextBox((5, 10, -5, 27), prompt)
        self.w.open()
    
    def getValue(self):
        return self.answer
    
    def buttonNoCallback(self, sender):
        self.answer = 0
        self.w.close()
        
    def buttonOKCallback(self, sender):
        self.answer = 1
        self.w.close()

def FindGlyph(aFont, message="Search for a glyph:", title='RoboFab'):
    raise NotImplementedError

def GetFile(message=None):
    strFilter = "All Files  (*.*)|*.*|"
    defaultExt = ""
    # using fontlab's internal file dialogs
    return fl.GetFileName(1, defaultExt, message, strFilter)

def GetFolder(message=None):
    # using fontlab's internal file dialogs
    if message is None:
        message = ""
    return fl.GetPathName(message)

def Message(message, title='RoboFab', informativeText=None):
    """ Display a standard message dialog.
        Note: informativeText is not supported on this platform.
    """
    if informativeText is not None:
        message = "%s\n%s"%(message, informativeText)
    _MessageDialog(message, title)
    
class _MessageDialog(object):
    def __init__(self, message, title):
        self.w = ModalDialog((360, 100), title)
        self.w.t = TextBox((5, 10, -5, -40), message)
        self.w.open()

    
def PutFile(message=None, defaultName=None):
    # using fontlab's internal file dialogs
    # message is not used
    if message is None:
        message = ""
    if defaultName is None:
        defaultName = ""
    defaultExt = ""
    return fl.GetFileName(0, defaultExt, defaultName, '')

def OneList(list, message="Select an item:", title='RoboFab'):
    raise NotImplementedError

def SearchList(list, message="Select an item:", title='RoboFab'):
    raise NotImplementedError

def SelectFont(message="Select a font:", title='RoboFab'):
    raise NotImplementedError

def SelectGlyph(font, message="Select a glyph:", title='RoboFab'):
    raise NotImplementedError

def TwoChecks(title_1="One",  title_2="Two", value1=1, value2=1, title='RoboFab'):
    raise NotImplementedError

def TwoFields(title_1="One:", value_1="0", title_2="Two:", value_2="0", title='RoboFab'):
    raise NotImplementedError


class ProgressBar(object):

    def __init__(self, title="RoboFab...", ticks=0, label=""):
        self._tickValue = 1
        fl.BeginProgress(title, ticks)

    def getCurrentTick(self):
        return self._tickValue

    def tick(self, tickValue=None):
        if not tickValue:
            tickValue = self._tickValue
        fl.TickProgress(tickValue)
        self._tickValue = tickValue + 1

    def label(self, label):
        pass

    def close(self):
        fl.EndProgress()


@@ -516,22 +516,23 @@
 kString(
-prompt
+message
 , value=
@@ -591,22 +591,23 @@
 gDialog(
-prompt
+message
 , value,
@@ -707,22 +707,23 @@
 _(self, 
-prompt
+message
 , value,
@@ -905,38 +905,39 @@
 5, 10, -5, 27), 
-prompt
+message
 )%0A        self.w
@@ -1159,22 +1159,23 @@
 oCancel(
-prompt
+message
 , title=
@@ -1194,16 +1194,38 @@
 efault=1
+, informativeText=None
 ):%0A    d
@@ -1262,22 +1262,23 @@
 lDialog(
-prompt
+message
 , title=
@@ -1489,22 +1489,23 @@
 _(self, 
-prompt
+message
 , defaul
@@ -1804,14 +1804,15 @@
 7), 
-prompt
+message
 )%0A  
@@ -2197,24 +2197,114 @@
 message=None
+, title=None, directory=None, fileName=None, allowsMultipleSelection=False, fileTypes=None
 ):%0A    strFi
@@ -2482,24 +2482,83 @@
 message=None
+, title=None, directory=None, allowsMultipleSelection=False
 ):%0A    # usi
@@ -3206,23 +3206,20 @@
 e=None, 
-default
+file
 Name=Non
@@ -3344,23 +3344,20 @@
 %0A    if 
-default
+file
 Name is 
@@ -3370,23 +3370,20 @@
         
-default
+file
 Name = %22
@@ -3445,23 +3445,20 @@
 ultExt, 
-default
+file
 Name, ''

Change the "prompt" argument to "message" to get in line with the other dialogs. Change the "defaultName" argument to "fileName" to get in line with the other dialogs. Extend the arguments in the function calls. These new arguments often can't be supported in the (older) dialogs, but at least the script can go on.