コード例 #1
0
ファイル: karmix.py プロジェクト: zero804/superkaramba
def initWidget(widget):
    global mixer
    mixer = ossaudiodev.openmixer()

    vol_main = karamba.getThemeImage(widget, "vol_main")
    (l, r) = mixer.get(ossaudiodev.SOUND_MIXER_VOLUME)
    vol_main_value = max(l, r)
    karamba.resizeImage(widget, vol_main, vol_main_value, 10)

    vol_pcm = karamba.getThemeImage(widget, "vol_pcm")
    (l, r) = mixer.get(ossaudiodev.SOUND_MIXER_PCM)
    vol_pcm_value = max(l, r)
    karamba.resizeImage(widget, vol_pcm, vol_pcm_value, 10)

    vol_cd = karamba.getThemeImage(widget, "vol_cd")
    (l, r) = mixer.get(ossaudiodev.SOUND_MIXER_CD)
    vol_cd_value = max(l, r)
    karamba.resizeImage(widget, vol_cd, vol_cd_value, 10)

    vol_mic = karamba.getThemeImage(widget, "vol_mic")
    (l, r) = mixer.get(ossaudiodev.SOUND_MIXER_MIC)
    vol_mic_value = max(l, r)
    karamba.resizeImage(widget, vol_mic, vol_mic_value, 10)

    karamba.redrawWidget(widget)
コード例 #2
0
	def draw(self,widget,angle):
		if (self.prev==angle):
			return
		self.prev=angle
		karamba.rotateImage(widget,self.imgshadow,angle)
		karamba.rotateImage(widget,self.imghand,angle)
		a=angle/180.0*math.pi
		x1=self.center_x+self.r1*math.cos(a+self.a1)
		y1=self.center_y+self.r1*math.sin(a+self.a1)
		x2=self.center_x+self.r2*math.cos(a+self.a2)
		y2=self.center_y+self.r2*math.sin(a+self.a2)
		x3=self.center_x+self.r3*math.cos(a+self.a3)
		y3=self.center_y+self.r3*math.sin(a+self.a3)
		x4=self.center_x+self.r4*math.cos(a+self.a4)
		y4=self.center_y+self.r4*math.sin(a+self.a4)
		xl=x1
		if (x2<xl):
			xl=x2
		if (x3<xl):
			xl=x3
		if (x4<xl):
			xl=x4
		yl=y1
		if (y2<yl):
			yl=y2
		if (y3<yl):
			yl=y3
		if (y4<yl):
			yl=y4
		xm=x1
		if (x2>xm):
			xm=x2
		if (x3>xm):
			xm=x3
		if (x4>xm):
			xm=x4
		ym=y1
		if (y2>ym):
			ym=y2
		if (y3>ym):
			ym=y3
		if (y4>ym):
			ym=y4
		karamba.resizeImage(widget,self.imgshadow,int(xm-xl),int(ym-yl))
		karamba.moveImage(widget,self.imgshadow,int(xl),int(yl)+self.shadowlevel)
		karamba.resizeImage(widget,self.imghand,int(xm-xl),int(ym-yl))
		karamba.moveImage(widget,self.imghand,int(xl),int(yl))
コード例 #3
0
ファイル: karmix.py プロジェクト: zero804/superkaramba
def widgetMouseMoved(widget, x, y, button):
    global onMidButton,onLeftButton
    global mixer
    if(button == 1 and onLeftButton == 0):
        # We are holding the left button here
        if ((y>=17) and (y<=28)):
            vol_main = karamba.getThemeImage(widget, "vol_main")
            vol_main_value = max(min(x-40,100),0)
            karamba.resizeImage(widget, vol_main, vol_main_value, 10)
            mixer.set(ossaudiodev.SOUND_MIXER_VOLUME, (vol_main_value, vol_main_value))
            karamba.redrawWidget(widget)

        if ((y>=47) and (y<=58)):
            vol_pcm = karamba.getThemeImage(widget, "vol_pcm")
            vol_pcm_value = max(min(x-40,100),0)
            karamba.resizeImage(widget, vol_pcm, vol_pcm_value, 10)
            mixer.set(ossaudiodev.SOUND_MIXER_PCM, (vol_pcm_value, vol_pcm_value))
            karamba.redrawWidget(widget)

        if ((y>=77) and (y<=88)):
            vol_cd = karamba.getThemeImage(widget, "vol_cd")
            vol_cd_value = max(min(x-40,100),0)
            karamba.resizeImage(widget, vol_cd, vol_cd_value, 10)
            mixer.set(ossaudiodev.SOUND_MIXER_CD, (vol_cd_value, vol_cd_value))
            karamba.redrawWidget(widget)

        if ((y>=107) and (y<=118)):
            vol_mic = karamba.getThemeImage(widget, "vol_mic")
            vol_mic_value = max(min(x-40,100),0)
            karamba.resizeImage(widget, vol_mic, vol_mic_value, 10)
            mixer.set(ossaudiodev.SOUND_MIXER_MIC, (vol_mic_value, vol_mic_value))
            karamba.redrawWidget(widget)
                
    if(button == 2 and onMidButton == 0):
        # We are holding the middle button here
        pass
コード例 #4
0
ファイル: image.py プロジェクト: Fat-Zer/tdeutils
def widgetUpdated(widget):
    global images, c
    
    b = c%2

    # Create & delete
    if(images[0]):
      karamba.deleteImage(widget, images[0])
      images[0] = 0
    else:
      images[0] = karamba.createImage(widget, 0, 20, "flag.png")
			
    # Hide & Show
    if(b):
      karamba.hideImage(widget, images[1])
    else:
      karamba.showImage(widget, images[1])
    
    # size & resize
    size = karamba.getImageSize(widget, images[1])
    print "getImageSize: " + str(size)
    print "getImageWidth: " + str(karamba.getImageWidth(widget, images[1]))
    print "getImageHeight: " + str(karamba.getImageHeight(widget, images[1]))
    # Auto size
    #size = ((b * 200) + 200, size[1])    
    #karamba.resizeImage(widget, images[1], size[0], size[1])
    
    # pos & move
    pos = karamba.getImagePos(widget, images[2])
    print "getImagePos: " + str(pos)
    pos = (b * 200, pos[1])    
    karamba.moveImage(widget, images[2], pos[0], pos[1])
    
    # Sensor
    sensor = karamba.getImageSensor(widget, images[3])
    print "getSensor: " + str(sensor)
    if(b):
      karamba.setImageSensor(widget, images[3], 'SENSOR=PROGRAM  PROGRAM="/tmp/test1.sh"')
    else:
      karamba.setImageSensor(widget, images[3], 'SENSOR=PROGRAM  PROGRAM="/tmp/test2.sh"')
      
    # Value
    v = karamba.getImagePath(widget, images[4])
    print "getImagePath: ", v
    if(b):
      v = 'flag.png'
    else:
      v = 'flag2.png'
    karamba.setImagePath(widget, images[4], v)
    
    if((c % 10) == 0):
      karamba.removeImageEffects(widget, images[5])
      karamba.removeImageEffects(widget, images[6])
      karamba.removeImageEffects(widget, images[7])
    else:
      karamba.changeImageIntensity(widget, images[5], (float(c%10) / 5 - 1.0))
      karamba.changeImageChannelIntensity(widget, images[6], (float(c%10) / 5 - 1.0), 'blue')
      karamba.changeImageToGray(widget, images[7], 0)

    if((c % 9) == 0):
      karamba.removeImageTransformations(widget, images[8])
      karamba.removeImageTransformations(widget, images[9])
      karamba.removeImageTransformations(widget, images[10])
    else:
      karamba.rotateImage(widget, images[8], (c%9)*20 + 45)
      karamba.resizeImage(widget, images[9], 50 + (c%5)*10, size[1])
      karamba.resizeImageSmooth(widget, images[10], 50 + (c%5)*10, size[1])
      
    if((c % 10) == 0):
      karamba.addImageTooltip(widget, images[11], str(c))
      
    if((c % 20) == 0):
      if(images[12]):
        karamba.deleteImage(widget, images[12])
        images[12] = 0
      else:
        images[12] = karamba.createBackgroundImage(widget, 0, 340, "flag.png")
    
    if(images[13]):
      karamba.deleteImage(widget, images[13])
      images[13] = 0
    else:
      tlist = karamba.getTaskList(widget)
      images[13] = karamba.createTaskIcon(widget, 50, 340, tlist[c % len(tlist)])
      
    c += 1
コード例 #5
0
ファイル: image.py プロジェクト: zero804/superkaramba
def widgetUpdated(widget):
    global images, c

    b = c % 2

    # Create & delete
    if (images[0]):
        karamba.deleteImage(widget, images[0])
        images[0] = 0
    else:
        images[0] = karamba.createImage(widget, 0, 20, "flag.png")

    # Hide & Show
    if (b):
        karamba.hideImage(widget, images[1])
    else:
        karamba.showImage(widget, images[1])

    # size & resize
    size = karamba.getImageSize(widget, images[1])
    print "getImageSize: " + str(size)
    print "getImageWidth: " + str(karamba.getImageWidth(widget, images[1]))
    print "getImageHeight: " + str(karamba.getImageHeight(widget, images[1]))
    # Auto size
    #size = ((b * 200) + 200, size[1])
    #karamba.resizeImage(widget, images[1], size[0], size[1])

    # pos & move
    pos = karamba.getImagePos(widget, images[2])
    print "getImagePos: " + str(pos)
    pos = (b * 200, pos[1])
    karamba.moveImage(widget, images[2], pos[0], pos[1])

    # Sensor
    sensor = karamba.getImageSensor(widget, images[3])
    print "getSensor: " + str(sensor)
    if (b):
        karamba.setImageSensor(widget, images[3],
                               'SENSOR=PROGRAM  PROGRAM="/tmp/test1.sh"')
    else:
        karamba.setImageSensor(widget, images[3],
                               'SENSOR=PROGRAM  PROGRAM="/tmp/test2.sh"')

    # Value
    v = karamba.getImagePath(widget, images[4])
    print "getImagePath: ", v
    if (b):
        v = 'flag.png'
    else:
        v = 'flag2.png'
    karamba.setImagePath(widget, images[4], v)

    if ((c % 10) == 0):
        karamba.removeImageEffects(widget, images[5])
        karamba.removeImageEffects(widget, images[6])
        karamba.removeImageEffects(widget, images[7])
    else:
        karamba.changeImageIntensity(widget, images[5],
                                     (float(c % 10) / 5 - 1.0))
        karamba.changeImageChannelIntensity(widget, images[6],
                                            (float(c % 10) / 5 - 1.0), 'blue')
        karamba.changeImageToGray(widget, images[7], 0)

    if ((c % 9) == 0):
        karamba.removeImageTransformations(widget, images[8])
        karamba.removeImageTransformations(widget, images[9])
        karamba.removeImageTransformations(widget, images[10])
    else:
        karamba.rotateImage(widget, images[8], (c % 9) * 20 + 45)
        karamba.resizeImage(widget, images[9], 50 + (c % 5) * 10, size[1])
        karamba.resizeImageSmooth(widget, images[10], 50 + (c % 5) * 10,
                                  size[1])

    if ((c % 10) == 0):
        karamba.addImageTooltip(widget, images[11], str(c))

    if ((c % 20) == 0):
        if (images[12]):
            karamba.deleteImage(widget, images[12])
            images[12] = 0
        else:
            images[12] = karamba.createBackgroundImage(widget, 0, 340,
                                                       "flag.png")

    if (images[13]):
        karamba.deleteImage(widget, images[13])
        images[13] = 0
    else:
        tlist = karamba.getTaskList(widget)
        images[13] = karamba.createTaskIcon(widget, 50, 340,
                                            tlist[c % len(tlist)])

    c += 1