def __init__(self, options, historyId):
        super().__init__(Rect(16, 2, 64, 20), self.changeDirTitle)
        self.options |= ofCentered
        self.dirInput = InputLine(Rect(3, 3, 30, 4), 68)
        self.insert(self.dirInput)

        self.insert(Label(Rect(2, 2, 17, 3), self.dirNameText, self.dirInput))
        self.insert(History(Rect(30, 3, 33, 4), self.dirInput, historyId))
        sb = ScrollBar(Rect(32, 6, 33, 16))
        self.insert(sb)
        self.dirList = DirListBox(Rect(3, 6, 32, 16), sb)
        self.insert(self.dirList)
        self.insert(Label(Rect(2, 5, 17, 6), self.dirTreeText, self.dirList))

        self.okButton = Button(Rect(35, 6, 45, 8), self.okText, cmOK,
                               bfDefault)
        self.insert(self.okButton)
        self.chDirButton = Button(Rect(35, 9, 45, 11), self.chDirText,
                                  cmChangeDir, bfNormal)
        self.insert(self.chDirButton)

        if options & cdHelpButton:
            self.insert(
                Button(Rect(35, 15, 45, 17), self.helpText, cmHelp, bfNormal))
        if not options & cdNoLoadDir:
            self.setupDialog()
        self.selectNext(False)
Exemple #2
0
    def newDialog(self, demoDialogData):
        pd = Dialog(Rect(20, 6, 60, 19), "Demo Dialog")
        b = CheckBoxes(Rect(3, 3, 18, 6),
                       ("~H~avarti", "~T~ilset", "~J~arlsberg"))

        pd.insert(b)
        pd.insert(Label(Rect(2, 2, 10, 3), "Cheeses", b))

        b = RadioButtons(Rect(22, 3, 34, 6),
                         ("~S~olid", "~R~unny", "~M~elted"))

        pd.insert(b)

        pd.insert(Label(Rect(21, 2, 33, 3), "Consistency", b))

        b = InputLine(Rect(3, 8, 37, 9), 128)
        pd.insert(b)

        pd.insert(Label(Rect(2, 7, 24, 8), "Delivery Instructions", b))
        pd.insert(Button(Rect(15, 10, 25, 12), "~O~K", cmOK, bfDefault))
        pd.insert(Button(Rect(28, 10, 38, 12), "~C~ancel", cmCancel, bfNormal))
        pd.setData(demoDialogData)

        control = self.desktop.execView(pd)
        data = None
        if control != cmCancel:
            data = pd.getData()
        del pd
        return data
Exemple #3
0
    def __init__(self, palette, groups):
        super().__init__(Rect(0, 0, 79, 18), self.colors)
        self.groupIndex = None
        self.colorIndexes = None

        self.options |= ofCentered
        if palette:
            self.pal = palette
        else:
            self.pal = None

        sb = ScrollBar(Rect(27, 3, 28, 14))
        self.insert(sb)

        self._groups = ColorGroupList(Rect(3, 3, 27, 14), sb, groups)
        self.insert(self._groups)
        self.insert(Label(Rect(3, 2, 10, 3), self.groupText, self._groups))

        sb = ScrollBar(Rect(59, 3, 60, 14))
        self.insert(sb)

        p = ColorItemList(Rect(30, 3, 59, 14), sb, groups.items)
        self.insert(p)

        self.insert(Label(Rect(30, 2, 36, 3), self.itemText, p))

        self._forSel = ColorSelector(Rect(63, 3, 75, 7),
                                     ColorSelector.csForeground)

        self.insert(self._forSel)

        self._forLabel = Label(Rect(63, 2, 75, 3), self.forText, self._forSel)
        self.insert(self._forLabel)

        self._bakSel = ColorSelector(Rect(63, 9, 75, 11),
                                     ColorSelector.csBackground)
        self.insert(self._bakSel)
        self._bakLabel = Label(Rect(63, 8, 75, 9), self.bakText, self._bakSel)
        self.insert(self._bakLabel)

        self._display = ColorDisplay(Rect(62, 12, 76, 14), self.textText)
        self.insert(self._display)

        self._monoSel = MonoSelector(Rect(62, 3, 77, 7))
        self._monoSel.hide()
        self.insert(self._monoSel)
        self._monoLabel = Label(Rect(62, 2, 69, 3), self.colorText,
                                self._monoSel)
        self._monoLabel.hide()
        self.insert(self._monoLabel)

        self.insert(Button(Rect(51, 15, 61, 17), self.okText, cmOK, bfDefault))
        self.insert(
            Button(Rect(63, 15, 73, 17), self.cancelText, cmCancel, bfNormal))
        self.selectNext(False)
        if self.pal:
            self.setData(self.pal)
Exemple #4
0
    def __init__(self, wildCard, title, inputLabel, options, histId):
        super().__init__(Rect(15, 1, 64, 20), title)

        self.directory = ''
        self.options |= ofCentered
        self.wildCard = wildCard
        self.filename = FileInputLine(Rect(3, 3, 31, 4), 79)
        self.filename.setData(self.wildCard)
        self.insert(self.filename)

        self.insert(Label(Rect(2, 2, 3 + nameLength(inputLabel), 3), inputLabel, self.filename))
        self.insert(History(Rect(31, 3, 34, 4), self.filename, histId))

        sb = ScrollBar(Rect(3, 14, 34, 15))
        self.insert(sb)
        self.fileList = FileList(Rect(3, 6, 34, 14), sb)
        self.insert(self.fileList)
        self.insert(Label(Rect(2, 5, 8, 6), self.filesText, self.fileList))

        opt = bfDefault
        r = Rect(35, 3, 46, 5)

        if options & fdOpenButton:
            self.insert(Button(r, self.openText, cmFileOpen, opt))
            opt = bfNormal
            r.topLeft.y += 3
            r.bottomRight.x += 3

        if options & fdOKButton:
            self.insert(Button(r, self.okText, cmFileOpen, opt))
            opt = bfNormal
            r.topLeft.y += 3
            r.bottomRight.y += 3

        if options & fdReplaceButton:
            self.insert(Button(r, self.replaceText, cmFileReplace, opt))
            r.topLeft.y += 3
            r.bottomRight.y += 3

        if options & fdClearButton:
            self.insert(Button(r, self.clearText, cmFileClear, opt))
            r.topLeft.y += 3
            r.bottomRight.y += 3

        self.insert(FileInfoPane(Rect(1, 16, 48, 18)))

        self.selectNext(False)
        if not (options & fdNoLoadDir):
            self._readCurrentDirectory()
Exemple #5
0
    def __init__(self):
        super().__init__(Rect(0, 0, 34, 12), _('Mouse options'))
        r = Rect(3, 4, 30, 5)
        self.options |= ofCentered
        self.mouseScrollBar = ScrollBar(r)
        self.mouseScrollBar.setParams(1, 1, 20, 20, 1)
        self.mouseScrollBar.options |= ofSelectable
        self.mouseScrollBar.setValue(EventQueue.doubleDelay)
        self.insert(self.mouseScrollBar)

        r = Rect(2, 2, 21, 3)
        self.insert(Label(r, _('~M~ouse double click'), self.mouseScrollBar))

        r = Rect(3, 3, 30, 4)
        self.insert(ClickTester(r, _('Fast       Medium      Slow')))

        r = Rect(3, 6, 30, 7)
        self.insert(CheckBoxes(r, (_('~R~everse mouse buttons'), )))
        self.oldDelay = EventQueue.doubleDelay

        r = Rect(9, 9, 19, 11)
        self.insert(Button(r, _('O~K~'), cmOK, bfDefault))

        r = Rect(21, 9, 31, 11)
        self.insert(Button(r, _('Cancel'), cmCancel, bfNormal))

        self.selectNext(False)
Exemple #6
0
def inputBoxRect(bounds, title, aLabel, s, limit):
    dialog = Dialog(bounds, title)
    r = Rect(4 + len(aLabel), 2, dialog.size.x - 3, 3)
    control = InputLine(r, limit)
    dialog.insert(control)

    r = Rect(2, 2, 3 + len(aLabel), 3)
    dialog.insert(Label(r, aLabel, control))

    r = Rect(dialog.size.x - 24, dialog.size.y - 4, dialog.size.x - 14,
             dialog.size.y - 2)

    dialog.insert(Button(r, MsgBoxText.okText, cmOK, bfDefault))

    r.topLeft.x += 12
    r.bottomRight.x += 12
    dialog.insert(Button(r, MsgBoxText.cancelText, cmCancel, bfNormal))

    dialog.selectNext(False)
    dialog.setData([s])

    c = execView(dialog)
    rec = None
    if c != cmCancel:
        rec = dialog.getData()[0]
    return c, rec
Exemple #7
0
    def newDialog(self):
        pd = Dialog(Rect(20, 6, 60, 19), 'Demo Dialog')
        b = CheckBoxes(Rect(3, 3, 18, 6), ('~H~avarti', '~T~ilset', '~J~arlsberg'))
        pd.insert(b)
        pd.insert(Label(Rect(2, 2, 10, 3), 'Cheeses', b))
        b = RadioButtons(Rect(22, 3, 34, 6), ('~S~olid', '~R~unny', '~M~elted',))
        pd.insert(b)
        pd.insert(Label(Rect(21, 2, 33, 3), 'Consistency', b))

        b = InputLine(Rect(3, 8, 37, 9), 128)
        pd.insert(b)

        pd.insert(Label(Rect(2, 7, 24, 8), 'Delivery Instructions', b))
        pd.insert(Button(Rect(15, 10, 25, 12), '~O~K', cmOK, bfDefault))
        pd.insert(Button(Rect(28, 10, 38, 12), '~C~ancel', cmCancel, bfNormal))
        pd.setData(demoDialogData)

        control = self.desktop.execView(pd)
        data = []
        if control != cmCancel:
            data = pd.getData()
        del pd
        return data
Exemple #8
0
def createReplaceDialog():
    d = Dialog(Rect(0, 0, 40, 16), 'Replace')
    d.options |= ofCentered

    control = InputLine(Rect(3, 3, 34, 4), 80)
    d.insert(control)
    d.insert(Label(Rect(2, 2, 34, 3), '~T~ext to find', control))
    d.insert(History(Rect(34, 3, 37, 4), control, 10))

    control = InputLine(Rect(3, 6, 34, 7), 80)
    d.insert(control)
    d.insert(Label(Rect(2, 5, 34, 6), '~N~ew _text', control))
    d.insert(History(Rect(34, 6, 37, 7), control, 11))

    d.insert(
        CheckBoxes(Rect(3, 8, 37, 12),
                   ('~C~ase sensitive', '~W~hole words only',
                    '~P~rompt on replace', '~R~eplace all')))

    d.insert(Button(Rect(17, 13, 27, 15), 'O~K~', cmOK, bfDefault))
    d.insert(Button(Rect(28, 13, 38, 15), 'Cancel', cmCancel, bfNormal))
    d.selectNext(False)
    return d
Exemple #9
0
def createFindDialog():
    d = Dialog(Rect(0, 0, 38, 12), 'Find')
    d.options |= ofCentered
    control = InputLine(Rect(3, 3, 32, 4), 80)
    d.insert(control)
    d.insert(Label(Rect(2, 2, 32, 3), '~T~ext to find', control))
    d.insert(History(Rect(32, 3, 35, 4), control, 10))

    d.insert(
        CheckBoxes(Rect(3, 5, 35, 7),
                   ('~C~ase sensitive', '~W~hole words only', None)))
    d.insert(Button(Rect(14, 9, 24, 11), 'O~K~', cmOK, bfDefault))
    d.insert(Button(Rect(26, 9, 36, 11), 'Cancel', cmCancel, bfNormal))
    d.selectNext(False)
    return d
Exemple #10
0
    def __init__(self):
        super().__init__(Rect(0, 0, 42, 16), 'Validator Example')
        self.options |= ofCentered
        obj = InputLine(Rect(23, 1, 40, 2), 40)
        self.insert(obj)
        self.insert(Label(Rect(1, 1, 22, 2), 'No validator', obj))

        obj = InputLine(Rect(23, 3, 27, 4), 3, RangeValidator(1, 31))
        self.insert(obj)
        self.insert(Label(Rect(1, 3, 22, 4), 'Date Style', obj))
        self.insert(StaticText(Rect(27, 3, 28, 4), '/'))

        line = InputLine(Rect(28, 3, 32, 4), 3)
        self.insert(line)
        line.setValidator(RangeValidator(1, 12))

        self.insert(StaticText(Rect(32, 3, 33, 4), '/'))
        self.insert(
            InputLine(Rect(33, 3, 39, 4), 5, RangeValidator(1950, 2050)))

        self.insert(Button(Rect(1, 13, 11, 15), 'O~K~', cmOK, bfDefault))
        self.insert(
            Button(Rect(12, 13, 24, 15), '~C~ancel', cmCancel, bfNormal))
        self.selectNext(False)