Example #1
0
    def __init__(self):
        '''
        Constructor
        '''
        SogalForm.__init__(self, fading = True, fading_duration = 0.5, enableMask = True,backgroundColor= color_themes.ilia_bgColor)
        self.reparentTo(aspect2d,sort = 102)
        self.frame = DirectScrolledFrame(parent = self, canvasSize = SAVE_CANVAS_SIZE, 
                                         frameSize = FRAMESIZE, 
                                         autoHideScrollBars = AUTO_HIDE_SCROLLBARS,
                                         **color_themes.ilia_frame)

        self.labels = []
        self.labelDict = {}
        self.vbox = VLayout(parent = self.frame.getCanvas(), margin = vspacing)
        hbox = None
        self.__dumped = None
        for i in range(1,MAX_SAVE + 1):
            fname = 'save' + str(i)
            head = str(i)
            label = SaveLoadLabel(command = self.save, always_enable = True, fileName = fname, head = head,extraArgs = [fname],style = color_themes.ilia_button)
            self.labels.append(label)
            self.labelDict[label.getFileName()] = label
            if not hbox:
                hbox = HLayout(margin = hspacing)
                self.vbox.append(hbox)
                hbox.append(label)
            else:
                hbox.append(label)
                hbox = None
Example #2
0
    def __init__(self):
        '''
        Constructor
        '''
        SogalForm.__init__(self, fading = True, fading_duration = 0.5, enableMask = True,backgroundColor=color_themes.sirius_bgColor)
        self.reparentTo(aspect2d,sort = 102)

        self.frame = DirectScrolledFrame(parent = self, canvasSize = LOAD_CANVAS_SIZE, 
                                         frameSize = FRAMESIZE, 
                                         autoHideScrollBars = AUTO_HIDE_SCROLLBARS,
                                         **color_themes.sirius_frame)
 
        self.labels = []
        self.labelDict = {}
        self.vbox = VLayout(parent = self.frame.getCanvas(), margin = vspacing)
        
        hbox = None
        self.__dumped = None
        
        pos2 = MAX_SAVE + runtime_data.MAX_QUICKSAVE
        pos3 = MAX_SAVE + runtime_data.MAX_QUICKSAVE + runtime_data.MAX_AUTOSAVE
        for i in range(1,  pos3 + 1):
            if i <= MAX_SAVE:
                fname = 'save' + str(i)
                head = str(i)
            elif MAX_SAVE < i <= pos2:
                index = i - MAX_SAVE
                fname = 'quick_save' + str(index)
                head = 'Quick Save ' + str(index)
            elif pos2 < i <= pos3:
                index = i - pos2
                fname = 'auto_save' + str(index)
                head = 'Auto Save ' + str(index)
                
            label = SaveLoadLabel(command = self.load, always_enable = False,
                                  fileName = fname, head = head, extraArgs = [fname],style = color_themes.sirius_button)
            self.labels.append(label)
            self.labelDict[label.getFileName()] = label
            if not hbox:
                hbox = HLayout(margin = hspacing)
                self.vbox.append(hbox)
                hbox.append(label)
            else:
                hbox.append(label)
                hbox = None
Example #3
0
    def __init__(self):
        '''
        Constructor
        '''
        SogalForm.__init__(self,
                           fading=True,
                           fading_duration=0.5,
                           enableMask=True,
                           backgroundColor=color_themes.sirius_bgColor)
        self.reparentTo(aspect2d, sort=102)

        self.frame = DirectScrolledFrame(
            parent=self,
            canvasSize=LOAD_CANVAS_SIZE,
            frameSize=FRAMESIZE,
            autoHideScrollBars=AUTO_HIDE_SCROLLBARS,
            **color_themes.sirius_frame)

        self.labels = []
        self.labelDict = {}
        self.vbox = VLayout(parent=self.frame.getCanvas(), margin=vspacing)

        hbox = None
        self.__dumped = None

        pos2 = MAX_SAVE + runtime_data.MAX_QUICKSAVE
        pos3 = MAX_SAVE + runtime_data.MAX_QUICKSAVE + runtime_data.MAX_AUTOSAVE
        for i in range(1, pos3 + 1):
            if i <= MAX_SAVE:
                fname = 'save' + str(i)
                head = str(i)
            elif MAX_SAVE < i <= pos2:
                index = i - MAX_SAVE
                fname = 'quick_save' + str(index)
                head = 'Quick Save ' + str(index)
            elif pos2 < i <= pos3:
                index = i - pos2
                fname = 'auto_save' + str(index)
                head = 'Auto Save ' + str(index)

            label = SaveLoadLabel(command=self.load,
                                  always_enable=False,
                                  fileName=fname,
                                  head=head,
                                  extraArgs=[fname],
                                  style=color_themes.sirius_button)
            self.labels.append(label)
            self.labelDict[label.getFileName()] = label
            if not hbox:
                hbox = HLayout(margin=hspacing)
                self.vbox.append(hbox)
                hbox.append(label)
            else:
                hbox.append(label)
                hbox = None
Example #4
0
    def __init__(self):
        '''
        Constructor
        '''
        SogalForm.__init__(self,
                           fading=True,
                           fading_duration=0.5,
                           enableMask=True,
                           backgroundColor=color_themes.ilia_bgColor)
        self.reparentTo(aspect2d, sort=102)
        self.frame = DirectScrolledFrame(
            parent=self,
            canvasSize=SAVE_CANVAS_SIZE,
            frameSize=FRAMESIZE,
            autoHideScrollBars=AUTO_HIDE_SCROLLBARS,
            **color_themes.ilia_frame)

        self.labels = []
        self.labelDict = {}
        self.vbox = VLayout(parent=self.frame.getCanvas(), margin=vspacing)
        hbox = None
        self.__dumped = None
        for i in range(1, MAX_SAVE + 1):
            fname = 'save' + str(i)
            head = str(i)
            label = SaveLoadLabel(command=self.save,
                                  always_enable=True,
                                  fileName=fname,
                                  head=head,
                                  extraArgs=[fname],
                                  style=color_themes.ilia_button)
            self.labels.append(label)
            self.labelDict[label.getFileName()] = label
            if not hbox:
                hbox = HLayout(margin=hspacing)
                self.vbox.append(hbox)
                hbox.append(label)
            else:
                hbox.append(label)
                hbox = None
Example #5
0
    def __init__(
            self,
            enableMask=True,  #NOTE THAT IT IS TRUE BY DEFAULT
            autoDestroy=True,
            sortType=0,  #0 for horizontal, 1 for vertical
            margin=0.2,
            textList=['OK', 'Cancel'],
            enablesList=None,
            command=None,
            frameSize=(-0.6, 0.6, -0.45, 0.45),
            buttonSize=BUTTON_SIZE,
            text='',
            textPos=(0, 0.2),
            startPos=(-0.4, 0, -0.2),
            extraArgs=[],
            style=None,
            fadeScreen=0.5,
            backgroundColor=None,
            **kwargs):
        if backgroundColor:
            bgColor = backgroundColor
        elif fadeScreen is not None:
            bgColor = (0, 0, 0, fadeScreen)
        else:
            bgColor = None

        SogalForm.__init__(self,
                           enableMask=enableMask,
                           backgroundColor=bgColor,
                           **kwargs)
        if enableMask:
            self.reparentTo(aspect2d, sort=1000)
        if not style:
            self.__style = base.getStyle()
        else:
            self.__style = color_themes.styles[style]

        self.__frame = DirectFrame(parent=self,
                                   frameSize=frameSize,
                                   **self.__style['hardframe'])
        self.__buttonList = []  #DirectButton(parent = self, s)
        self.__text = OnscreenText(parent=self,
                                   text=text,
                                   pos=textPos,
                                   **self.__style['text'])
        self.__command = command
        self.__autoDestroy = autoDestroy
        self._extraArgs = extraArgs

        if sortType == 0:
            self.__box = HLayout(margin=margin)
        else:
            self.__box = VLayout(margin=margin)
        self.__box.reparentTo(self)
        self.__box.setPos(startPos)

        for i in range(len(textList)):
            btn = DirectButton(text=textList[i],
                               command=self.buttonCommand(i),
                               frameSize=buttonSize,
                               **self.__style['button'])
            self.__buttonList.append(btn)
            self.__box.append(btn)

        if enablesList:
            for i in range(len(enablesList)):
                if i >= len(self.__buttonList):
                    break
                if enablesList[i]:
                    self.__buttonList[i]['state'] = DGG.NORMAL
                else:
                    self.__buttonList[i]['state'] = DGG.DISABLED

        self.show()