Пример #1
0
 def __init__(self):
     Window.__init__(self)
     
     # The main window
     self.create(100, 100, 500, 500, caption=True, minmax=False, resize=False)
     
     # The color data implements observable protocol
     self.color = ColorData()
     
     # Instantiation and Initialization of the components
     self.initText(self, 'R', (80, 45, 15, 15))
     self.initText(self, 'G', (80, 65, 15, 15))
     self.initText(self, 'B', (80, 85, 15, 15))
     
     self.initText(self, 'H', (80, 115, 15, 15))
     self.initText(self, 'S', (80, 135, 15, 15))
     self.initText(self, 'V', (80, 155, 15, 15))
     
     RGBEditObserver(self, self.color)
     RGBSliderObserver(self, self.color)
     
     HSVEditObserver(self, self.color)
     HSVSliderObserver(self, self.color)
     
     ColorMapObserver(self, self.color)
     ColorComponentObserver(self, self.color)
     #####
     
     # Restore color from disk 
     self.color.loadColor()
Пример #2
0
    def __init__(self):
        Window.__init__(self)

        # The main window
        self.create(100,
                    100,
                    500,
                    500,
                    caption=True,
                    minmax=False,
                    resize=False)

        # The color data implements observable protocol
        self.color = ColorData()

        # Instantiation and Initialization of the components
        self.initText(self, 'R', (80, 45, 15, 15))
        self.initText(self, 'G', (80, 65, 15, 15))
        self.initText(self, 'B', (80, 85, 15, 15))

        self.initText(self, 'H', (80, 115, 15, 15))
        self.initText(self, 'S', (80, 135, 15, 15))
        self.initText(self, 'V', (80, 155, 15, 15))

        RGBEditObserver(self, self.color)
        RGBSliderObserver(self, self.color)

        HSVEditObserver(self, self.color)
        HSVSliderObserver(self, self.color)

        ColorMapObserver(self, self.color)
        ColorComponentObserver(self, self.color)
        #####

        # Restore color from disk
        self.color.loadColor()
Пример #3
0
class ColorPickerWindow(Window):
    def __init__(self):
        Window.__init__(self)
        
        # The main window
        self.create(100, 100, 500, 500, caption=True, minmax=False, resize=False)
        
        # The color data implements observable protocol
        self.color = ColorData()
        
        # Instantiation and Initialization of the components
        self.initText(self, 'R', (80, 45, 15, 15))
        self.initText(self, 'G', (80, 65, 15, 15))
        self.initText(self, 'B', (80, 85, 15, 15))
        
        self.initText(self, 'H', (80, 115, 15, 15))
        self.initText(self, 'S', (80, 135, 15, 15))
        self.initText(self, 'V', (80, 155, 15, 15))
        
        RGBEditObserver(self, self.color)
        RGBSliderObserver(self, self.color)
        
        HSVEditObserver(self, self.color)
        HSVSliderObserver(self, self.color)
        
        ColorMapObserver(self, self.color)
        ColorComponentObserver(self, self.color)
        #####
        
        # Restore color from disk 
        self.color.loadColor()
    
    # Initialization functions    
    def initText(self, parent, text, rect):
        tempText = Text(parent)
        tempText.fontSize = 15
        tempText.text = text
        tempText.rect = rect
        
        return tempText
    
    def initEdit(self, parent, text, rect):
        tempEdit = Edit(parent)
        
        tempEdit.bgColor = color.black
        tempEdit.fontColor = color.white
        tempEdit.rect = rect
        tempEdit.text = text
        
        return tempEdit
    
    def initSlider(self, parent, rect):
        tempSlider = Slider(parent)
        
        tempSlider.bgColor = color.gray
        tempSlider.vertical = False
        tempSlider.rect = rect
        tempSlider.thumbMinSize = 10
        tempSlider.thumbImage = r'Images\SliderThumb.jpg'
        
        return tempSlider
    #####
               
    def close(self):
        print '[ColorPickerWindow::close] Window closed'
        # Save the color data to disk
        self.color.saveColor()
        super(ColorPickerWindow, self).close()
        
    def onDraw(self, render):
        render.Clear(255, 255, 255, 255)
Пример #4
0
class ColorPickerWindow(Window):
    def __init__(self):
        Window.__init__(self)

        # The main window
        self.create(100,
                    100,
                    500,
                    500,
                    caption=True,
                    minmax=False,
                    resize=False)

        # The color data implements observable protocol
        self.color = ColorData()

        # Instantiation and Initialization of the components
        self.initText(self, 'R', (80, 45, 15, 15))
        self.initText(self, 'G', (80, 65, 15, 15))
        self.initText(self, 'B', (80, 85, 15, 15))

        self.initText(self, 'H', (80, 115, 15, 15))
        self.initText(self, 'S', (80, 135, 15, 15))
        self.initText(self, 'V', (80, 155, 15, 15))

        RGBEditObserver(self, self.color)
        RGBSliderObserver(self, self.color)

        HSVEditObserver(self, self.color)
        HSVSliderObserver(self, self.color)

        ColorMapObserver(self, self.color)
        ColorComponentObserver(self, self.color)
        #####

        # Restore color from disk
        self.color.loadColor()

    # Initialization functions
    def initText(self, parent, text, rect):
        tempText = Text(parent)
        tempText.fontSize = 15
        tempText.text = text
        tempText.rect = rect

        return tempText

    def initEdit(self, parent, text, rect):
        tempEdit = Edit(parent)

        tempEdit.bgColor = color.black
        tempEdit.fontColor = color.white
        tempEdit.rect = rect
        tempEdit.text = text

        return tempEdit

    def initSlider(self, parent, rect):
        tempSlider = Slider(parent)

        tempSlider.bgColor = color.gray
        tempSlider.vertical = False
        tempSlider.rect = rect
        tempSlider.thumbMinSize = 10
        tempSlider.thumbImage = r'Images\SliderThumb.jpg'

        return tempSlider

    #####

    def close(self):
        print '[ColorPickerWindow::close] Window closed'
        # Save the color data to disk
        self.color.saveColor()
        super(ColorPickerWindow, self).close()

    def onDraw(self, render):
        render.Clear(255, 255, 255, 255)