Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
class DialogColorPicker(QDialog):
    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)

    def mousePressEvent(self, mouseevent: QMouseEvent) -> None:
        super().mousePressEvent(mouseevent)

        # Get the color from the color picker
        color = self.cp_ColorPicker.get_color()

        # Update the color of the Push Button
        style = "Background-color: " + color.name()
        self.qpb_Validate.setStyleSheet(style)
        self.zone.setStyleSheet(style)

        # Update the Color of the LED
        print("offset1 = ", self.zone.get_offset1())
        print("ledlength = ", self.zone.get_ledlength())
        for i in range(self.zone.get_offset1(),
                       self.zone.get_ledlength() + self.zone.get_offset1()):
            self.pixels[i] = (color.red(), color.green(), color.blue())
            print("i = ", i)

        print("offset2 = ", self.zone.get_offset2())
        for i in range(self.zone.get_offset2(),
                       self.zone.get_ledlength() + self.zone.get_offset2()):
            self.pixels[i] = (color.red(), color.green(), color.blue())

    @Slot(int)
    def showFullScreen(self, dummy):
        # super().showFullScreen()
        self.show()
        self.zone = self.sender()
        print(type(self.sender()))
        print(self.sender().get_offset1())
        print(self.sender().get_ledlength())
        print(self.sender().get_offset2())
        self.qpb_Validate.setStyleSheet(self.sender().styleSheet())
Ejemplo n.º 3
0
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()
Ejemplo n.º 4
0
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))
Ejemplo n.º 5
0
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()
    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()


    
    
Ejemplo n.º 7
0
	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
#realz_dir = '/home/dwillcox/400k/analysis/cf_brendan' # absolute path
realz_dir = '/home/eugene/simulations/flash_runs/hybrid-cone/hddt/v3/profile75/ign_true/400k/analysis/cf_brendan_pbIgnRho-7.2'
#pref = 'Realization_'
pref = '400k_Tc7e8_co_wd_R'
suff = '_ordered.dat'
os.chdir(realz_dir)

# Make a dictionary for the data
ifd = IntegralFlashData()
headers = []
shortheaders = []
rflist = glob.glob(pref + '*' + suff)
N = len(rflist)
print 'Found this many CO files: ' + str(N)

cpick = ColorPicker()
colors = cpick.pickColors(N)
first = True
for fn in rflist:
    print fn
    ni = int(fn.replace(pref,'').replace(suff,''))
    ifd.readInts(fn)
    ifd.GramsToMsun()
    ifdk = 'co_' + str(ni)
    ifdata[ifdk] = ifd.getArrayData()
    if first:
	headers = ifdata[ifdk].keys()
	shortheaders = [hj.replace(' > ','>').replace(' ','_') for hj in headers]
    pfmt[ifdk] = {'color': 'blue',
               'alpha': 0.75,
               'marker': None,
#realz_dir = '/home/dwillcox/400k/analysis/cf_brendan' # absolute path
realz_dir = '/home/eugene/simulations/flash_runs/hybrid-cone/hddt/v3/profile75/ign_true/400k/analysis/cf_brendan_pbIgnRho-7.2'
#pref = 'Realization_'
pref = '400k_Tc7e8_co_wd_R'
suff = '_ordered.dat'
os.chdir(realz_dir)

# Make a dictionary for the data
ifd = IntegralFlashData()
headers = []
shortheaders = []
rflist = glob.glob(pref + '*' + suff)
N = len(rflist)
print 'Found this many CO files: ' + str(N)

cpick = ColorPicker()
colors = cpick.pickColors(N)
first = True
for fn in rflist:
    print fn
    ni = int(fn.replace(pref, '').replace(suff, ''))
    ifd.readInts(fn)
    ifd.GramsToMsun()
    ifdk = 'co_' + str(ni)
    ifdata[ifdk] = ifd.getArrayData()
    if first:
        headers = ifdata[ifdk].keys()
        shortheaders = [
            hj.replace(' > ', '>').replace(' ', '_') for hj in headers
        ]
    pfmt[ifdk] = {