コード例 #1
0
ファイル: grids.py プロジェクト: late2game/ttools2
    def __init__(self, posSize, gridActive, ctrlsAmount, activeCtrls,
                 offgridActive, callback):
        Group.__init__(self, posSize)
        assert activeCtrls <= ctrlsAmount

        self.ctrlHeight = posSize[3]
        self.gridActive = gridActive
        self.ctrlsAmount = ctrlsAmount
        self.activeCtrls = activeCtrls
        self.offgridActive = offgridActive
        self.gridIndexes = [
            '{:d}'.format(integer) for integer in range(1, ctrlsAmount + 1)
        ]
        self.callback = callback

        self.gridsDB = [{
            'horizontal': False,
            'vertical': False,
            'step': None,
            'color': color
        } for color in GRID_COLOR_INIT]

        jumpin_Y = 4
        self.gridActiveCheck = CheckBox(
            (0, jumpin_Y, NET_WIDTH * .6,
             vanillaControlsSize['CheckBoxRegularHeight']),
            "Show grids",
            value=self.gridActive,
            callback=self.gridActiveCheckCallback)

        for eachI in range(1, ctrlsAmount + 1):
            jumpin_Y += vanillaControlsSize[
                'EditTextRegularHeight'] + MARGIN_VER
            gridCtrl = SingleGridController(
                (0, jumpin_Y, NET_WIDTH,
                 vanillaControlsSize['EditTextRegularHeight']),
                index=eachI,
                isVertical=False,
                isHorizontal=False,
                step=None,
                gridColor=GRID_COLOR_INIT[eachI - 1],
                callback=self.gridCtrlCallback)
            gridCtrl.enable(self.gridActive)
            setattr(self, 'grid{:0>2}'.format(eachI), gridCtrl)

        jumpin_Y += vanillaControlsSize['EditTextRegularHeight'] + MARGIN_VER
        self.showOffgridCheck = CheckBox(
            (0, jumpin_Y, NET_WIDTH,
             vanillaControlsSize['CheckBoxRegularHeight']),
            "Show offgrid points",
            value=self.offgridActive,
            callback=self.showOffgridCheckCallback)
コード例 #2
0
 def __init__(self, posSize, text, minValue, maxValue, value, callback):
     Group.__init__(self, posSize)
     self.text = TextBox((0, 0, -0, 20), text)
     self.slider = Slider((2, 20, -60, 17),
                          minValue=minValue,
                          maxValue=maxValue,
                          value=value,
                          sizeStyle="small",
                          callback=self.sliderChanged)
     self.edit = EditText((-40, 15, -0, 22),
                          text=str(value),
                          placeholder=str(value),
                          callback=self.editChanged)
     self.callback = callback
コード例 #3
0
ファイル: neighbors.py プロジェクト: late2game/ttools2
    def __init__(self, posSize, openedFontPaths, lftNeighborActive,
                 lftFontPath, lftGlyphName, cntNeighborActive, cntFontPath,
                 cntGlyphName, rgtNeighborActive, rgtFontPath, rgtGlyphName,
                 callback):

        Group.__init__(self, posSize)
        self.callback = callback
        self.ctrlHeight = posSize[3]

        self.neighborsDB = {}
        self.neighborsDB['lft'] = [
            lftNeighborActive, lftFontPath, lftGlyphName
        ]
        self.neighborsDB['cnt'] = [
            cntNeighborActive, cntFontPath, cntGlyphName
        ]
        self.neighborsDB['rgt'] = [
            rgtNeighborActive, rgtFontPath, rgtGlyphName
        ]

        jumpin_X = 0
        self.lftController = SingleNeighborController(
            (jumpin_X, 0, 60, self.ctrlHeight),
            'Left',
            isActive=lftNeighborActive,
            openedFontPaths=openedFontPaths,
            activeFontPath=lftFontPath,
            activeGlyphName=lftGlyphName,
            callback=self.lftControllerCallback)

        jumpin_X += 60 + MARGIN_HOR
        self.cntController = SingleNeighborController(
            (jumpin_X, 0, 60, self.ctrlHeight),
            'Center',
            isActive=cntNeighborActive,
            openedFontPaths=openedFontPaths,
            activeFontPath=cntFontPath,
            activeGlyphName=cntGlyphName,
            callback=self.cntControllerCallback)

        jumpin_X += 60 + MARGIN_HOR
        self.rgtController = SingleNeighborController(
            (jumpin_X, 0, 60, self.ctrlHeight),
            'Right',
            isActive=rgtNeighborActive,
            openedFontPaths=openedFontPaths,
            activeFontPath=rgtFontPath,
            activeGlyphName=rgtGlyphName,
            callback=self.rgtControllerCallback)
コード例 #4
0
 def __init__(self, posSize, minValue, maxValue, value, callback):
     Group.__init__(self, posSize)
     self.slider = Slider(
         (2, 3, -55, 17),
         minValue=minValue,
         maxValue=maxValue,
         value=value,
         sizeStyle="regular",
         callback=self.sliderChanged)
     self.edit = EditText(
         (-40, 0, -0, 22),
         text=str(value),
         placeholder=str(value),
         callback=self.editChanged)
     self.callback = callback
コード例 #5
0
ファイル: sidebar.py プロジェクト: late2game/ttools2
    def __init__(self, posSize, title, options, chosenOption, sizeStyle, callback):
        Group.__init__(self, posSize)
        self.callback = callback
        self.options = options
        width = posSize[2]
        height = posSize[3]

        self.caption = TextBox((0, 2, width*.5, height),
                               title,
                               sizeStyle=sizeStyle,
                               alignment='right')

        self.combo = ComboBox((width*.5, 0, width*.5-1, height),
                              options,
                              continuous=False,
                              sizeStyle=sizeStyle,
                              callback=self.comboCallback)
        self.combo.set(chosenOption)
コード例 #6
0
ファイル: grids.py プロジェクト: late2game/ttools2
    def __init__(self, posSize, index, isVertical, isHorizontal, step,
                 gridColor, callback):
        Group.__init__(self, posSize)

        # from arguments to attributes
        self.ctrlX, self.ctrlY, self.ctrlWidth, self.ctrlHeight = posSize
        self.index = index
        self.isVertical = isVertical
        self.isHorizontal = isHorizontal
        self.step = step
        self.gridColor = gridColor
        self.callback = callback

        # ctrls
        jumpin_X = 12
        self.indexText = TextBox(
            (jumpin_X, 0, 16, vanillaControlsSize['TextBoxRegularHeight']),
            '{:d})'.format(index))
        jumpin_X += self.indexText.getPosSize()[2]

        self.stepCtrl = EditText(
            (jumpin_X, 0, 38, vanillaControlsSize['EditTextRegularHeight']),
            callback=self.stepCtrlCallback)
        jumpin_X += self.stepCtrl.getPosSize()[2] + 16

        self.isHorizontalCheck = CheckBox(
            (jumpin_X, 0, 32, vanillaControlsSize['CheckBoxRegularHeight']),
            "H",
            value=self.isHorizontal,
            callback=self.isHorizontalCheckCallback)
        jumpin_X += self.isHorizontalCheck.getPosSize()[2] + 2

        self.isVerticalCheck = CheckBox(
            (jumpin_X, 0, 32, vanillaControlsSize['CheckBoxRegularHeight']),
            "V",
            value=self.isVertical,
            callback=self.isVerticalCheckCallback)
        jumpin_X += self.isVerticalCheck.getPosSize()[2] + 10

        self.whichColorWell = ColorWell(
            (jumpin_X, 0, 46, self.ctrlHeight),
            color=NSColor.colorWithCalibratedRed_green_blue_alpha_(*gridColor),
            callback=self.whichColorWellCallback)
コード例 #7
0
ファイル: bcps.py プロジェクト: late2game/ttools2
    def __init__(self, posSize, sqrActive, bcpLengthActive, callback):
        Group.__init__(self, posSize)

        self.ctrlHeight = posSize[3]
        self.sqrActive = sqrActive
        self.bcpLengthActive = bcpLengthActive
        self.callback = callback

        jumpin_Y = 2
        self.sqrCheck = CheckBox(
            (0, jumpin_Y, NET_WIDTH,
             vanillaControlsSize['CheckBoxRegularHeight']),
            "Show squarings",
            value=self.sqrActive,
            callback=self.sqrCheckCallback)

        jumpin_Y += vanillaControlsSize['CheckBoxRegularHeight']
        self.bcpLengthCheck = CheckBox(
            (0, jumpin_Y, NET_WIDTH,
             vanillaControlsSize['CheckBoxRegularHeight']),
            "Show bcp length",
            value=self.bcpLengthActive,
            callback=self.bcpLengthCheckCallback)
コード例 #8
0
ファイル: neighbors.py プロジェクト: late2game/ttools2
    def __init__(self, posSize, title, isActive, openedFontPaths,
                 activeFontPath, activeGlyphName, callback):
        Group.__init__(self, posSize)
        self.isActive = isActive
        self.openedFontPaths = openedFontPaths
        self.activeFontPath = activeFontPath
        self.activeGlyphName = activeGlyphName
        self.callback = callback
        ctrlWidth = posSize[2]

        # ui
        jumpingY = 4
        self.isActiveCheck = CheckBox(
            (0, jumpingY, ctrlWidth,
             vanillaControlsSize['CheckBoxRegularHeight']),
            title,
            value=self.isActive,
            callback=self.isActiveCallback)

        jumpingY += vanillaControlsSize['CheckBoxRegularHeight'] + 2
        self.fontPop = PopUpButton(
            (1, jumpingY, ctrlWidth - 1,
             vanillaControlsSize['PopUpButtonRegularHeight']),
            makeFontList(openedFontPaths),
            callback=self.fontPopCallback)

        jumpingY += vanillaControlsSize['PopUpButtonRegularHeight'] + MARGIN_VER

        if self.activeFontPath == CURRENT_FONT_REPR:
            activeFont = CurrentFont()
        else:
            activeFont = getOpenedFontFromPath(AllFonts(), self.activeFontPath)
        self.glyphPop = PopUpButton(
            (1, jumpingY, ctrlWidth - 1,
             vanillaControlsSize['ComboBoxRegularHeight']),
            makeGlyphList(activeFont),
            callback=self.glyphPopCallback)