Beispiel #1
0
    def __init__(self, bounds, title, headings, headRows, gridData, columns, rows, columnWidth, decimalPoint):
        super().__init__(bounds, title)
        self.options |= ofCentered
        maxStr = 30

        r = Rect(1, 3, self.size.x - 2, self.size.y - 3)

        self.hScrollBar = ScrollBar(Rect(r.topLeft.x, r.bottomRight.y, r.bottomRight.x, r.bottomRight.y + 1))
        self.vScrollBar = ScrollBar(Rect(r.bottomRight.x, r.topLeft.y, r.bottomRight.x + 1, r.bottomRight.y))

        self.listBox = GridViewBox(r, self.hScrollBar, self.vScrollBar, columnWidth, gridData, columns, rows,
                                   decimalPoint)
        self.listBox.growMode = gfGrowHiX | gfGrowHiY
        self.headingBox = GridHeadingView(Rect(r.topLeft.x, r.topLeft.y - headRows, r.bottomRight.x, r.topLeft.y),
                                          self.hScrollBar, self.vScrollBar, columnWidth, headings, columns, headRows,
                                          self.listBox)
        self.headingBox.growMode = gfGrowHiX

        self.inputLine = InputLine(Rect(r.topLeft.x, r.topLeft.y, r.topLeft.x + columnWidth[0] - 1,
                                        r.topLeft.y + 1), maxStr)
        self.inputLine.hide()

        self.itemNumber = InputLine(Rect(r.bottomRight.x - 10, r.bottomRight.y + 1, r.bottomRight.x - 1, r.bottomRight.y + 2), 5)
        self.itemNumber.options &= ~ofSelectable
        self.itemNumber.growMode |= gfGrowAll
        self.itemNumber.setData('{:2d},{:2d}'.format(self.listBox.focusedRow, self.listBox.focusedColumn))

        self.insert(self.hScrollBar)
        self.insert(self.vScrollBar)
        self.insert(self.headingBox)
        self.insert(self.listBox)
        self.insert(self.inputLine)
        self.insert(self.itemNumber)
Beispiel #2
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)
Beispiel #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)
Beispiel #4
0
    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)
Beispiel #5
0
class MouseDialog(Dialog):
    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)

    def handleEvent(self, event):
        super().handleEvent(event)
        if event.what == evCommand:
            if event.message.command == cmCancel:
                EventQueue.doubleDelay = self.oldDelay
        elif event.what == evBroadcast:
            if event.message.command == cmScrollBarChanged:
                EventQueue.doubleDelay = self.mouseScrollBar.value
                self.clearEvent(event)
Beispiel #6
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()
Beispiel #7
0
 def __init__(self, bounds):
     super().__init__(bounds, 'Data ListBox')
     t = self.getExtent()
     t.topLeft.x += 1
     t.topLeft.y += 1
     t.bottomRight.x -= 1
     t.bottomRight.y -= 2
     sb = ScrollBar(
         Rect(t.bottomRight.x - 2, t.topLeft.y + 1, t.bottomRight.x - 1,
              t.bottomRight.y - 2))
     self.insert(sb)
     self.insert(TechInfoList(t, 1, sb))
     self.insert(
         Button(Rect(10, t.bottomRight.y - 1, 20, t.bottomRight.y + 1),
                '~O~k', cmClose, bfDefault))
Beispiel #8
0
 def newDialog(self):
     pd = Dialog(Rect(20, 6, 60, 19), 'Demo Dialog')
     sb = ScrollBar(Rect(25, 2, 26, 11))
     pd.insert(sb)
     lb = ListBox(Rect(2, 2, 24, 11), 2, sb)
     pd.insert(lb)
     names = random.sample(animals, 20)
     tsc = StringCollection(names)
     pd.insert(Button(Rect(28, 6, 38, 8), '~O~K', cmOK, bfDefault))
     pd.insert(Button(Rect(28, 10, 38, 12), '~C~ancel', cmCancel, bfNormal))
     data = ListBoxRec()
     data.items = tsc
     data.selection = 2
     items = [data]
     pd.setData(items)
     control = self.desktop.execView(pd)
     if control != cmCancel:
         data = pd.getData()
         data = data[0]
     if control == cmOK:
         messageBox('\x03Your selection is {}'.format(tsc[data.selection]), mfInformation, (mfOKButton,))
     self.destroy(pd)