当前位置: 首页>>代码示例>>Python>>正文


Python dialogs.Dialog类代码示例

本文整理汇总了Python中albow.dialogs.Dialog的典型用法代码示例。如果您正苦于以下问题:Python Dialog类的具体用法?Python Dialog怎么用?Python Dialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Dialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: cancel

    def cancel(self, *args, **kwargs):
        Changes = False

        self.reshowNumberFields()

        for key in self.saveOldConfig.keys():
            if key.get() != self.saveOldConfig[key]:
                Changes = True
        if self.saveOldResourcePack != self.resourcePackButton.selectedChoice:
            Changes = True

        if not Changes:
            Dialog.dismiss(self, *args, **kwargs)
            return

        result = albow.ask("Do you want to save your changes?", ["Save", "Don't Save", "Cancel"])
        if result == "Cancel":
            return
        if result == "Save":
            self.dismiss(*args, **kwargs)
            return

        for key in self.saveOldConfig.keys():
            key.set(self.saveOldConfig[key])
        if self.resourcePackButton.selectedChoice != self.saveOldResourcePack:
            self.resourcePackButton.selectedChoice = self.saveOldResourcePack
            self.change_texture()
        config.save()
        Dialog.dismiss(self, *args, **kwargs)
开发者ID:germanalen,项目名称:MCEdit-Unified,代码行数:29,代码来源:graphics.py

示例2: __init__

    def __init__(self, mcedit):
        Dialog.__init__(self)

        self.mcedit = mcedit

        self.langs = {}
        self.sgnal = {}
开发者ID:Dominic001,项目名称:MCEdit-Unified,代码行数:7,代码来源:options.py

示例3: dismiss

    def dismiss(self, *args, **kwargs):
        """Used to change the language and the font proportion"""
        lang = config.settings.langCode.get() == old_lang or config.settings.langCode.get() == self.saveOldConfig[config.settings.langCode]
        font = config.settings.fontProportion.get() == old_fprop or config.settings.fontProportion.get() == self.saveOldConfig[config.settings.fontProportion]
        #-# The following lines will be used for the language and font dynamic changes
        #-# The restart boxes will be suppressed.
#        lang = config.settings.langCode.get() == self.saveOldConfig[config.settings.langCode]
#        font = config.settings.fontProportion.get() == self.saveOldConfig[config.settings.fontProportion]
#        self.changeLanguage()

#        if not font or not lang:
#            editor = self.mcedit.editor
#            if editor and editor.unsavedEdits:
#                result = albow.ask("You must restart MCEdit to see language changes", ["Save and Restart", "Restart", "Later"])
#            else:
#                result = albow.ask("You must restart MCEdit to see language changes", ["Restart", "Later"])
#            if result == "Save and Restart":
#                editor.saveFile()
#                self.mcedit.restart()
#            elif result == "Restart":
#                self.mcedit.restart()
#            elif result == "Later":
#                pass

        self.reshowNumberFields()
        for key in self.saveOldConfig.keys():
            self.saveOldConfig[key] = key.get()

        config.save()
        Dialog.dismiss(self, *args, **kwargs)
开发者ID:Techius,项目名称:MCEdit-Unified,代码行数:30,代码来源:options.py

示例4: dismiss

 def dismiss(self, *args, **kwargs):
     """Used to change the language."""
     lng = config.settings.langCode.get()
     try:
         o, n, sc = albow.translate.setLang(lng)
     except:
         o, n, sc = albow.translate.setLang(self.langs[lng])
     if not sc and n != "en_US":
         albow.alert(_("{} is not a valid language").format("%s [%s]" % (self.sgnal[n], n)))
         if o == n:
             o = "en_US"
         config.settings.langCode.set(o)
         albow.translate.setLang(o)
     elif o != n:
         editor = self.mcedit.editor
         if editor and editor.unsavedEdits:
             result = albow.ask("You must restart MCEdit to see language changes", ["Save and Restart", "Restart", "Later"])
         else:
             result = albow.ask("You must restart MCEdit to see language changes", ["Restart", "Later"])
         if result == "Save and Restart":
             editor.saveFile()
             self.mcedit.restart()
         elif result == "Restart":
             self.mcedit.restart()
         elif result == "Later":
             pass
     Dialog.dismiss(self, *args, **kwargs)
开发者ID:Dominic001,项目名称:MCEdit-Unified,代码行数:27,代码来源:options.py

示例5: dismiss

    def dismiss(self, *args, **kwargs):
        self.checkMaxView()
        for key in self.saveOldConfig.keys():
            self.saveOldConfig[key] = key.get()
        self.saveOldResourcePack = self.resourcePackButton.selectedChoice

        config.save()
        Dialog.dismiss(self, *args, **kwargs)
开发者ID:Estevo-Aleixo,项目名称:MCEdit-Unified,代码行数:8,代码来源:graphics.py

示例6: __init__

    def __init__(self, mcedit):
        Dialog.__init__(self)
        self.changes = {}
        self.changesNum = False
        self.enter = 0
        self.root = None
        self.editor = None

        buttonRow = (albow.Button("Assign Key...", action=self.askAssignSelectedKey),
                    albow.Button("Done", action=self.done), albow.Button("Cancel", action=self.cancel))

        buttonRow = albow.Row(buttonRow)

        resetToDefaultRow = albow.Row((albow.Button("Reset to default", action=self.resetDefault),))

        choiceButton = albow.ChoiceButton(["WASD", "ESDF", "Arrows", "Numpad", "WASD Old"], choose=self.choosePreset)
        if config.keys.forward.get() == "E":
            choiceButton.selectedChoice = "ESDF"
        elif config.keys.forward.get() == "Up":
            choiceButton.selectedChoice = "Arrows"
        elif config.keys.forward.get() == "[8]":
            choiceButton.selectedChoice = "Numpad"
        elif config.keys.brake.get() == "Space":
            choiceButton.selectedChoice = "WASD Old"

        self.oldChoice = choiceButton.selectedChoice

        choiceRow = albow.Row((albow.Label("Keybind Presets:"), choiceButton))
        self.choiceButton = choiceButton

        #.#
        spacing = 0
        tb = albow.TableView()
        self.nrows = 581 / tb.font.get_linesize()
        keyConfigTable = albow.TableView(nrows=581 / tb.font.get_linesize(),
            columns=[albow.TableColumn("Command", 200, "l"), albow.TableColumn("Assigned Key", 150, "r")])
        del tb
        keyConfigTable.num_rows = lambda: len(self.keyConfigKeys)
        keyConfigTable.row_data = self.getRowData
        keyConfigTable.row_is_selected = lambda x: x == self.selectedKeyIndex
        keyConfigTable.click_row = self.selectTableRow
        keyConfigTable.key_down = self.key_down
        keyConfigTable.key_up = self.key_up
        tableWidget = albow.Widget()
        tableWidget.add(keyConfigTable)
        tableWidget.shrink_wrap()

        self.keyConfigTable = keyConfigTable
        #.#

        col = albow.Column((tableWidget, choiceRow, buttonRow, resetToDefaultRow), spacing=spacing, margin=0)
        self.add(col)
        self.shrink_wrap()
开发者ID:Iciciliser,项目名称:MCEdit-Unified,代码行数:53,代码来源:keys.py

示例7: __init__

    def __init__(self, mcedit):
        Dialog.__init__(self)

        self.mcedit = mcedit

        fieldOfViewRow = mceutils.FloatInputRow("Field of View: ",
                                                ref=config.settings.fov, width=100, min=25, max=120)

        targetFPSRow = mceutils.IntInputRow("Target FPS: ",
                                            ref=config.settings.targetFPS, width=100, min=1, max=60)

        bufferLimitRow = mceutils.IntInputRow("Vertex Buffer Limit (MB): ",
                                              ref=config.settings.vertexBufferLimit, width=100, min=0)

        fastLeavesRow = mceutils.CheckBoxLabel("Fast Leaves",
                                               ref=config.settings.fastLeaves,
                                               tooltipText="Leaves are solid, like Minecraft's 'Fast' graphics")

        roughGraphicsRow = mceutils.CheckBoxLabel("Rough Graphics",
                                                  ref=config.settings.roughGraphics,
                                                  tooltipText="All blocks are drawn the same way (overrides 'Fast Leaves')")

        enableMouseLagRow = mceutils.CheckBoxLabel("Enable Mouse Lag",
                                                   ref=config.settings.enableMouseLag,
                                                 tooltipText="Enable choppy mouse movement for faster loading.")

        packs = resource_packs.packs.get_available_resource_packs()
        packs.remove('Default')
        packs.sort()
        packs.insert(0, 'Default')
        self.resourcePackButton = mceutils.ChoiceButton(packs, choose=self.change_texture)
        self.resourcePackButton.selectedChoice = resource_packs.packs.get_selected_resource_pack_name()

        settingsColumn = albow.Column((fastLeavesRow,
                                       roughGraphicsRow,
                                       enableMouseLagRow,
                                       #                                  texturePackRow,
                                       fieldOfViewRow,
                                       targetFPSRow,
                                       bufferLimitRow,
                                       self.resourcePackButton,
                                      ), align='r')

        settingsColumn = albow.Column((albow.Label("Settings"),
                                       settingsColumn))

        settingsRow = albow.Row((settingsColumn,))

        optionsColumn = albow.Column((settingsRow, albow.Button("OK", action=self.dismiss)))

        self.add(optionsColumn)
        self.shrink_wrap()
开发者ID:Dominic001,项目名称:MCEdit-Unified,代码行数:52,代码来源:graphics.py

示例8: __init__

 def __init__(self):
     Dialog.__init__(self)
     emc = EnableMusicControl()
     mvc = MusicVolumeControl()
     controls = Grid([
         [Label("Enable Music"), emc],
         [Label("Music Volume"), mvc],
     ])
     buttons = Button("OK", self.ok)
     contents = Column([controls, buttons], align = 'r', spacing = 20)
     contents.topleft = (20, 20)
     self.add(contents)
     self.shrink_wrap()
开发者ID:codewarrior0,项目名称:mcedit,代码行数:13,代码来源:music.py

示例9: dismiss

    def dismiss(self, *args, **kwargs):
        """Used to change the font proportion."""
        # If font proportion setting has changed, update the UI.
        if config.settings.fontProportion.get() != self.saveOldConfig[config.settings.fontProportion]:
            albow.resource.reload_fonts(proportion=config.settings.fontProportion.get())
            self.mcedit.root.set_update_ui(True)
            self.mcedit.root.set_update_ui(False)
            self.mcedit.editor.set_update_ui(True)
            self.mcedit.editor.set_update_ui(False)

        self.reshowNumberFields()
        for key in self.saveOldConfig.keys():
            self.saveOldConfig[key] = key.get()

        config.save()
        Dialog.dismiss(self, *args, **kwargs)
开发者ID:Crayder,项目名称:MCEdit-Unified,代码行数:16,代码来源:options.py

示例10: __init__

 def __init__(self, prompt=None, suffixes=None, **kwds):
     Dialog.__init__(self, **kwds)
     label = None
     d = self.margin
     self.suffixes = suffixes or ("",)
     up_button = Button(self.up_button_text, action=self.go_up)
     dir_box = DirPathView(self.box_width + 250, self)
     self.dir_box = dir_box
     top_row = Row([dir_box, up_button])
     list_box = FileListView(self.box_width - 16, self)
     self.list_box = list_box
     tree = FSTree(self, inner_width=250, directory="/")
     self.tree = tree
     row = Row((tree, list_box), margin=0)
     ctrls = [top_row, row]
     prompt = prompt or self.default_prompt
     if prompt:
         label = Label(prompt)
     if self.saving:
         filename_box = TextFieldWrapped(self.box_width)
         filename_box.change_action = self.update_filename
         filename_box._enter_action = filename_box.enter_action
         filename_box.enter_action = self.enter_action
         self.filename_box = filename_box
         ctrls.append(Column([label, filename_box], align="l", spacing=0))
     else:
         if label:
             ctrls.insert(0, label)
     ok_button = Button(self.ok_label, action=self.ok, enable=self.ok_enable)
     self.ok_button = ok_button
     cancel_button = Button("Cancel", action=self.cancel)
     vbox = Column(ctrls, align="l", spacing=d)
     vbox.topleft = (d, d)
     y = vbox.bottom + d
     ok_button.topleft = (vbox.left, y)
     cancel_button.topright = (vbox.right, y)
     self.add(vbox)
     self.add(ok_button)
     self.add(cancel_button)
     self.shrink_wrap()
     self._directory = None
     self.directory = os.getcwdu()
     # print "FileDialog: cwd =", repr(self.directory) ###
     if self.saving:
         filename_box.focus()
开发者ID:germanalen,项目名称:MCEdit-Unified,代码行数:45,代码来源:file_dialogs.py

示例11: openSavePresetDialog

    def openSavePresetDialog(self):
        """
        Opens up a dialgo to input the name of the to save Preset.
        """
        panel = Dialog()
        label = Label("Preset Name:")
        nameField = TextFieldWrapped(width=200)

        def okPressed():
            panel.dismiss()
            name = nameField.value

            if name in ['Load Preset', 'Remove Presets', '__temp__']:
                alert("That preset name is reserved. Try pick another preset name.")
                return

            for p in ['<','>',':','\"', '/', '\\', '|', '?', '*', '.']:
                if p in name:
                    alert('Invalid character in file name')
                    return

            self.tool.saveBrushPreset(name)
            self.tool.showPanel()

        okButton = Button("OK", action=okPressed)
        cancelButton = Button("Cancel", action=panel.dismiss)
        namerow = Row([label,nameField])
        buttonRow = Row([okButton,cancelButton])

        panel.add(Column([namerow, buttonRow]))
        panel.shrink_wrap()
        panel.present()
开发者ID:fhfuih,项目名称:MCEdit-Unified,代码行数:32,代码来源:brush.py

示例12: removePreset

    def removePreset(self):
        """
        Brings up a panel to remove presets.
        """
        panel = Dialog()
        p = self.getBrushFileList()
        if not p:
            alert('No presets saved')
            return

        def okPressed():
            panel.dismiss()
            name = p[presetTable.selectedIndex] + ".preset"
            os.remove(os.path.join(directories.brushesDir, name))
            self.tool.showPanel()

        def selectTableRow(i, evt):
            presetTable.selectedIndex = i
            if evt.num_clicks == 2:
                okPressed()

        presetTable = TableView(columns=(TableColumn("", 200),))
        presetTable.num_rows = lambda: len(p)
        presetTable.row_data = lambda i: (p[i],)
        presetTable.row_is_selected = lambda x: x == presetTable.selectedIndex
        presetTable.click_row = selectTableRow
        presetTable.selectedIndex = 0
        choiceCol = Column((ValueDisplay(width=200, get_value=lambda: "Select preset to delete"), presetTable))
        okButton = Button("OK", action=okPressed)
        cancelButton = Button("Cancel", action=panel.dismiss)
        row = Row([okButton, cancelButton])
        panel.add(Column((choiceCol, row)))
        panel.shrink_wrap()
        panel.present()
开发者ID:fhfuih,项目名称:MCEdit-Unified,代码行数:34,代码来源:brush.py

示例13: __init__

    def __init__(self, mcedit):
        Dialog.__init__(self)

        self.mcedit = mcedit

        self.langs = {}
        self.sgnal = {}
        self.portableVar = albow.AttrRef(self, 'portableLabelText')
        self.saveOldPortable = self.portableVar.get()

        self.saveOldConfig = {
            config.controls.autobrake:                        config.controls.autobrake.get(),
            config.controls.swapAxes:                         config.controls.swapAxes.get(),
            config.controls.cameraAccel:                      config.controls.cameraAccel.get(),
            config.controls.cameraDrag:                       config.controls.cameraDrag.get(),
            config.controls.cameraMaxSpeed:                   config.controls.cameraMaxSpeed.get(),
            config.controls.cameraBrakingSpeed:               config.controls.cameraBrakingSpeed.get(),
            config.controls.mouseSpeed:                       config.controls.mouseSpeed.get(),
            config.settings.undoLimit:                        config.settings.undoLimit.get(),
            config.settings.maxCopies:                        config.settings.maxCopies.get(),
            config.controls.invertMousePitch:                 config.controls.invertMousePitch.get(),
            config.settings.spaceHeight:                      config.settings.spaceHeight.get(),
            albow.AttrRef(self, 'blockBuffer'):               albow.AttrRef(self, 'blockBuffer').get(),
            config.settings.setWindowPlacement:               config.settings.setWindowPlacement.get(),
            config.settings.rotateBlockBrush:                 config.settings.rotateBlockBrush.get(),
            config.settings.shouldResizeAlert:                config.settings.shouldResizeAlert.get(),
            config.settings.superSecretSettings:              config.settings.superSecretSettings.get(),
            config.settings.longDistanceMode:                 config.settings.longDistanceMode.get(),
            config.settings.flyMode:                          config.settings.flyMode.get(),
            config.settings.langCode:                         config.settings.langCode.get(),
            config.settings.compassToggle:                    config.settings.compassToggle.get(),
            config.settings.compassSize:                      config.settings.compassSize.get(),
            config.settings.fontProportion:                   config.settings.fontProportion.get(),
            config.settings.fogIntensity:                     config.settings.fogIntensity.get(),
            config.schematicCopying.cancelCommandBlockOffset: config.schematicCopying.cancelCommandBlockOffset.get()
        }
        global old_lang
        if old_lang == None:
            old_lang = config.settings.langCode.get()
        global old_fprop
        if old_fprop == None:
            old_fprop = config.settings.fontProportion.get()
开发者ID:Iciciliser,项目名称:MCEdit-Unified,代码行数:42,代码来源:options.py

示例14: __init__

    def __init__(self):
        Dialog.__init__(self)
        keyConfigTable = albow.TableView(nrows=30,
            columns=[albow.TableColumn("Command", 200, "l"), albow.TableColumn("Assigned Key", 150, "r")])
        keyConfigTable.num_rows = lambda: len(self.keyConfigKeys)
        keyConfigTable.row_data = self.getRowData
        keyConfigTable.row_is_selected = lambda x: x == self.selectedKeyIndex
        keyConfigTable.click_row = self.selectTableRow
        keyConfigTable.key_down = self.key_down
        keyConfigTable.key_up = self.key_up
        self.changes = {}
        self.changesNum = False
        self.enter = 0
        self.root = None
        self.editor = None
        tableWidget = albow.Widget()
        tableWidget.add(keyConfigTable)
        tableWidget.shrink_wrap()

        self.keyConfigTable = keyConfigTable

        buttonRow = (albow.Button("Assign Key...", action=self.askAssignSelectedKey),
                    albow.Button("Done", action=self.done))

        buttonRow = albow.Row(buttonRow)

        choiceButton = mceutils.ChoiceButton(["WASD", "Arrows", "Numpad", "WASD Old"], choose=self.choosePreset)
        if config.keys.forward.get() == "Up":
            choiceButton.selectedChoice = "Arrows"
        elif config.keys.forward.get() == "[8]":
            choiceButton.selectedChoice = "Numpad"
        elif config.keys.brake.get() == "Space":
            choiceButton.selectedChoice = "WASD Old"

        self.oldChoice = choiceButton.selectedChoice

        choiceRow = albow.Row((albow.Label("Presets: "), choiceButton))
        self.choiceButton = choiceButton

        col = albow.Column((tableWidget, choiceRow, buttonRow))
        self.add(col)
        self.shrink_wrap()
开发者ID:Dominic001,项目名称:MCEdit-Unified,代码行数:42,代码来源:keys.py

示例15: __init__

    def __init__(self, inventory, data, *args, **kwargs):
        Dialog.__init__(self, *args, **kwargs)
        self.inventory = inventory
        slot, id, count, damage = data
        self.former_id_text = id
        self.slot = slot
        self.id = TextFieldWrapped(text=id, doNotTranslate=True, width=300)
        self.id.change_action = self.text_entered
        self.id.escape_action = self.cancel
        self.id.enter_action = self.ok
        self.count = IntField(text="%s"%count, min=0, max=64)
        self.damage = IntField(text="%s"%damage, min=0, max=os.sys.maxint)
        header = Label(_("Inventory Slot #%s")%slot, doNotTranslate=True)
        row = Row([Label("id"), self.id,
                   Label("Count"), self.count,
                   Label("Damage"), self.damage,
                   ])
        
        self.matching_items = [mclangres.translate(k) for k in map_items.keys()]
        self.matching_items.sort()
        self.selected_item_index = None
        if id in self.matching_items:
            self.selected_item_index = self.matching_items.index(id)
        self.tableview = tableview = TableView(columns=[TableColumn("", 415, 'l')])
        tableview.num_rows = lambda: len(self.matching_items)
        tableview.row_data = lambda x: (self.matching_items[x],)
        tableview.row_is_selected = lambda x: x == self.selected_item_index
        tableview.click_row = self.select_tablerow
        
        
        buttons = Row([Button("Save", action=self.dismiss), Button("Cancel", action=self.cancel)])
        col = Column([header, row, tableview, buttons], spacing=2)
        self.add(col)
        self.shrink_wrap()

        try:
            self.tableview.rows.scroll_to_item(self.selected_item_index)
        except Exception, e:
            print e
            pass
开发者ID:vongola12324,项目名称:MCEdit-Unified,代码行数:40,代码来源:nbtexplorer.py


注:本文中的albow.dialogs.Dialog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。