def __init__(self): super().__init__() self.cp_ColorPicker = ColorPicker(200) self.qpb_Validate = QPushButton("CLOSE") self.qvbl_MainLayout = QVBoxLayout() self.setLayout(self.qvbl_MainLayout) self.zone = Zone(0, 1, 0) self.pixels = neopixel.NeoPixel(board.D18, 150) # Construct the interface self.qvbl_MainLayout.addWidget(self.cp_ColorPicker) self.qvbl_MainLayout.addWidget(self.qpb_Validate) self.qpb_Validate.clicked.connect(self.close)
try: action = str(sys.argv[1]) except: pass try: argument1 = str(sys.argv[2]) except: pass try: argument2 = str(sys.argv[3]) except: pass try: argument3 = str(sys.argv[4]) except: pass if action == "COLORPICKER": from ColorPicker import ColorPicker colorPicker = ColorPicker("ColorPicker.xml", __cwd__, "default", "1080i") colorPicker.skinString = argument1 colorPicker.doModal() del colorPicker elif action == "SETVIEW": MainModule.setView() elif action == "ENABLEVIEWS": MainModule.enableViews()
import matplotlib.pyplot as plt import numpy as np import sys # Get the number of colors from one command line integer argument try: Nh = int(sys.argv[1]) Ns = int(sys.argv[2]) Nv = int(sys.argv[3]) N = Nh*Ns*Nv except: print 'Please enter three command line integers specifying the number of colors to generate in hsv.' exit() # Now get the colors cpick = ColorPicker() print 'hsv: ' + str(Nh) + ',' + str(Ns) + ',' + str(Nv) colors = cpick.pickColors(Nh,Ns,Nv) print colors # Generate sample data class Line: def __init__(self,x,a,b): self.x = np.array(x) self.y = a*self.x+b intercept = 0.0 npts = 10 xvector = np.linspace(0,1.0,npts,dtype=np.float64) data = [] for i in xrange(N): data.append(Line(xvector,float(i+1),intercept))
from Component import Component from Application import Application from Box import Box from Button import Button from ColorPicker import ColorPicker sys = Component('system') app = sys.attach(Component('app')) app.attach(Application('main')) app.attach(Box('box1')) app.attach(Box('box2')) app.attach(Button('button')) app.attach(ColorPicker('color picker')) app.start() app.stop()
def __init__(self, levelmanager): # whether edit mode is showing or not self.levelmanager = levelmanager self.game = levelmanager self.mode = False self.level = None self.editButton = EditButton(self) self.lockButton = LockButton(self) self.newButton = NewButton(self) Concurrent.__init__(self) EventMonitor.__init__(self) # make sure we are placed in front of other things self.priority = 2 # edit button turns on the other buttons self.Add(self.editButton) # all the other buttons self.buttonGroup = ImageRadioButtonGroup() # hold on to all the buttons self.editInterface = EditInterface() self.editInterface.Add(self.buttonGroup) for b in ['platform', 'ladder', 'portal', 'item', '---', 'move', 'delete', 'clone']: FamilyButton(b, self, self.buttonGroup) self.pentool = Tools.PenTool(self, self.buttonGroup) self.linetool = Tools.LineTool(self, self.buttonGroup) self.filltool = Tools.FillTool(self, self.buttonGroup) self.airbrushtool = Tools.AirbrushTool(self, self.buttonGroup) # tools which remote users are currently using (created dynamically) self.networktools = {} # the save button self.editInterface.Add(self.newButton) self.editInterface.Add(self.lockButton) # portal destination selector self.portalDestinationIcon = PortalDestinationIcon(self) self.editInterface.Add(self.portalDestinationIcon) # other stuff self.selected = "" self.down = False self.rect = None self.currentSurface = None self.color = (255, 255, 255) self.colorPicker = ColorPicker(self) self.editInterface.Add(self.colorPicker) self.lastHover = None self.loadProgress = 0 # for some tools we need to know where the mouse button down event happened, so we can rubber band and the like... self.mouseDownPosition = [None,None] # for some tools, while the mouse is moving, we need to know the last mousemove pixel position. This stores that. # this way we can tell wether a mouse move actually moves through a large pixel to another self.mouseMovePosition = [None,None] # saved subimage for rubber banding self.savedImage = None # for line tool self.image_start = None # once we have received a level udpate from the server, we should tell the game about it self.startDest = None