Exemple #1
0
def prompt(message="", title="", default="", multiline=False, password=None, 
           parent=None):
    "Modal dialog asking for an input, returns string or None if cancelled"
    if password:
        style = wx.TE_PASSWORD | wx.OK | wx.CANCEL
        result = dialogs.textEntryDialog(parent, message, title, default, style)
    elif multiline:
        style = wx.TE_MULTILINE | wx.OK | wx.CANCEL
        result = dialogs.textEntryDialog(parent, message, title, default, style)
        # workaround for Mac OS X
        result.text = '\n'.join(result.text.splitlines())
    else:
        result = dialogs.textEntryDialog(parent, message, title, default)
    if result.accepted:
        return result.text
Exemple #2
0
def prompt(message="", title="", default="", multiline=False, password=None, 
           parent=None):
    "Modal dialog asking for an input, returns string or None if cancelled"
    if password:
        style = wx.TE_PASSWORD | wx.OK | wx.CANCEL
        result = dialogs.textEntryDialog(parent, message, title, default, style)
    elif multiline:
        style = wx.TE_MULTILINE | wx.OK | wx.CANCEL
        result = dialogs.textEntryDialog(parent, message, title, default, style)
        # workaround for Mac OS X
        result.text = '\n'.join(result.text.splitlines())
    else:
        result = dialogs.textEntryDialog(parent, message, title, default)
    if result.accepted:
        return result.text
 def on_add_label(self, event):
     """add a new label to the TreeCtrl, call from the parent"""
     entry = textEntryDialog(
         self, _("Label Name:"), _("Enter a name for the new label."), style=wx.BORDER_NONE | wx.OK | wx.CANCEL
     )
     text = entry.text.strip()
     if text != "":
         self._add_label(entry.text)
Exemple #4
0
def multilineTextEntryDialog(parent=None,
                             message='',
                             title='',
                             defaultText='',
                             style=wx.TE_MULTILINE | wx.OK | wx.CANCEL):
    result = dialogs.textEntryDialog(parent, message, title, defaultText,
                                     style)
    # workaround for Mac OS X
    result.text = '\n'.join(result.text.splitlines())
    return result
Exemple #5
0
def ChangeAppKey(frame, callback):
    """
    Asks the user for a new appkey.
    If the user pressed cancel, the appkey remains unchanged.
    """
    global userconfig_appKey
    result = dialogs.textEntryDialog(frame, "Add meg az AppKey-edet:",
                                        "Új AppKey", userconfig_appKey)
    if result.accepted:
        userconfig_appKey = result.text
        RefreshUserDataDefault(callback)
Exemple #6
0
def ChangeAppKey(frame, callback):
    """
    Asks the user for a new appkey.
    If the user pressed cancel, the appkey remains unchanged.
    """
    global userconfig_appKey
    result = dialogs.textEntryDialog(frame, "Add meg az AppKey-edet:",
                                     "Új AppKey", userconfig_appKey)
    if result.accepted:
        userconfig_appKey = result.text
        RefreshUserDataDefault(callback)
Exemple #7
0
 def onRenameEvent(self, event):
     """重命名"""
     selected = len(self.getSelectedFiles())
     if selected == 1:
         # self.__onEditNameStart(event)
         index = self.__dataList.GetFirstSelected()
         key = self.itemDataMap[index][0]
         results = dialogs.textEntryDialog(self, u"请输入修改的名字", u"重命名", key)
         if results.accepted :
             newKey = results.text
             try:
                 ret, info = self.__bucketManger.rename(self.__bucketName, key, newKey)
                 if info.ok():
                     wx.MessageBox(u"重命名成功!", u"成功")
                 else:
                     wx.MessageBox(info.error, u"错误")
             except:
                 wx.MessageBox(u"名字错误,查阅七牛文档!", u"错误")
     else:
         wx.MessageBox(u"不能同时重命名多个文件!", u"错误")
Exemple #8
0
 def onRenameEvent(self, event):
     """重命名"""
     selected = len(self.getSelectedFiles())
     if selected == 1:
         # self.__onEditNameStart(event)
         index = self.__dataList.GetFirstSelected()
         key = self.itemDataMap[index][0]
         results = dialogs.textEntryDialog(self, u"请输入修改的名字", u"重命名", key)
         if results.accepted:
             newKey = results.text
             try:
                 ret, info = self.__bucketManger.rename(
                     self.__bucketName, key, newKey)
                 if info.ok():
                     wx.MessageBox(u"重命名成功!", u"成功")
                 else:
                     wx.MessageBox(info.error, u"错误")
             except:
                 wx.MessageBox(u"名字错误,查阅七牛文档!", u"错误")
     else:
         wx.MessageBox(u"不能同时重命名多个文件!", u"错误")
Exemple #9
0
        self.userstatusButton.Disable()
        for b in self.printerPanel.buttons:
            b.Disable()
        pass


# Main program

# Check for user config. If there is no AppKey, we have to ask the user
try:
    userconfig_appKey
except NameError:
    userconfig_appKey = ""
    userconfig_userStatus = "on"
    userconfig_printerStatus = {}
    result = dialogs.textEntryDialog(None, "Add meg az AppKey-edet:",
                                     "AppKey megadása", userconfig_appKey)
    if result.text == "":
        sys.exit()
    else:
        userconfig_appKey = result.text

def Cleanup():
    """Saves the user's configuration and makes the user go offline."""
    with open(platformspec.configfilename, "w") as f:
        f.write("userconfig_appKey = " + repr(userconfig_appKey) + "\n")
        if userData.status == True:
            sStatus = "on"
        else:
            sStatus = "off"
        f.write("userconfig_userStatus = " + repr(sStatus) + "\n")
        d = {}
Exemple #10
0
        self.userstatusButton.Disable()
        for b in self.printerPanel.buttons:
            b.Disable()
        pass


# Main program

# Check for user config. If there is no AppKey, we have to ask the user
try:
    userconfig_appKey
except NameError:
    userconfig_appKey = ""
    userconfig_userStatus = "on"
    userconfig_printerStatus = {}
    result = dialogs.textEntryDialog(None, "Add meg az AppKey-edet:",
                                     "AppKey megadása", userconfig_appKey)
    if result.text == "":
        sys.exit()
    else:
        userconfig_appKey = result.text


def Cleanup():
    """Saves the user's configuration and makes the user go offline."""
    with open(platformspec.configfilename, "w") as f:
        f.write("userconfig_appKey = " + repr(userconfig_appKey) + "\n")
        if userData.status == True:
            sStatus = "on"
        else:
            sStatus = "off"
        f.write("userconfig_userStatus = " + repr(sStatus) + "\n")
Exemple #11
0
def passwordTextEntryDialog(parent=None,
                            message='',
                            title='',
                            defaultText='',
                            style=wx.TE_PASSWORD | wx.OK | wx.CANCEL):
    return dialogs.textEntryDialog(parent, message, title, defaultText, style)