Exemplo n.º 1
0
def createMenu(widget):
	global fill

	## Set Title Heise ## 
	getTitle()

	#first = karamba.createText(widget, 14, 1, 50, line_height, "Heise:")
	#setStyle(widget, first, 7, 15)
	#karamba.changeTextColor(widget, first, r,g,b)
	
	fill.insert(0, karamba.createText(widget, 90, 1, 50, line_height, "Online"))
	setStyle(widget, fill[0], 7, 15)
	karamba.changeTextColor(widget, fill[0], r,g,b)
	karamba.attachClickArea(widget, fill[0], "")
	
	## Set Title Mobile 
	fill.insert(1, karamba.createText(widget, 175, 1, 50, line_height, "Mobil"))
	setStyle(widget, fill[1], 7, 15)
	karamba.changeTextColor(widget, fill[1], r,g,b)
	karamba.attachClickArea(widget, fill[1], "")
	
	## Set Title Security 
	fill.insert(2, karamba.createText(widget, 255, 1, 60, line_height, "Security"))
	setStyle(widget, fill[2], 7, 15)
	karamba.changeTextColor(widget, fill[2], r,g,b)
	karamba.attachClickArea(widget, fill[2], "")
	
	## Set Description
	getDescription()
Exemplo n.º 2
0
    def printEpisodeList(self):

        # Reset text if necessary
        for i in range( len( self.refEpisodeList ) ):
            # Remove click areas
            karamba.removeClickArea(Applet.widget, self.refEpisodeUrls[i])
            # Remove text
            karamba.deleteText(Applet.widget, self.refEpisodeList[i])
            karamba.deleteText(Applet.widget, self.refEpisodeListWhen[i])
        self.refEpisodeUrls     = []
        self.refEpisodeList     = []
        self.refEpisodeListWhen = []

        # Write episode list
        for i in range( len( self.episodeList ) ):
            color = self._processColor( self.episodeList[i]['delta'] )

            posTitleY = self.themeHeaderWH[1] + ( self.themeBodyWH[1] * i ) + self.themeBodyTitleXY[1]
            posWhenY  = self.themeHeaderWH[1] + ( self.themeBodyWH[1] * i ) + self.themeBodyWhenXY[1]

            episodeText = tools.formatEpisode( self.episodeList[i], self.episodeFormatString )
            refT = karamba.createText(Applet.widget, self.themeBodyTitleXY[0], posTitleY, self.themeBodyTitleWH[0], self.themeBodyTitleWH[1], episodeText)
            karamba.changeTextColor(Applet.widget, refT, color[0], color[1], color[2])
            self.refEpisodeList.append( refT )

            cmd = self.browser.replace( "$url$", self.episodeList[i]['url'] )
            refUrl = karamba.createClickArea(Applet.widget, self.themeBodyTitleXY[0], posTitleY, self.themeBodyTitleWH[0], self.themeBodyTitleWH[1], cmd)
            self.refEpisodeUrls.append( refUrl )

            whenText = self._formatWhen( self.episodeList[i]['airdate'], self.episodeList[i]['delta'] )
            refW = karamba.createText(Applet.widget, self.themeBodyWhenXY[0], posWhenY, self.themeBodyWhenWH[0], self.themeBodyWhenWH[1], whenText)
            karamba.changeTextColor(Applet.widget, refW, color[0], color[1], color[2])
            karamba.setTextAlign(Applet.widget, refW, "CENTER")
            karamba.attachClickArea(Applet.widget, refW)
            self.refEpisodeListWhen.append( refW )
def initWidget(widget):
    global resX
    global numOfTasks
    global taskPanels
    global taskText
    global timeText

    karamba.createImage(widget, resX - 149, 0, "pics/rightend_new.png")
    numOfTasks = (resX - 198 - 149) / 121

    timeText = karamba.createText(widget, resX - 149 + 54, 10, 140, 20, "time")
    karamba.changeTextColor(widget, timeText, 0, 0, 0)
    karamba.changeTextSize(widget, timeText, 9)

    for i in range(numOfTasks):
        taskPanels.append(
            karamba.createImage(widget, 198 + (121 * i), 3,
                                "pics/task_new.png"))
        taskText.append(
            karamba.createText(widget, 198 + (121 * i) + 9, 9, 100, 20, ""))

    for text in taskText:
        karamba.changeTextSize(widget, text, 9)

    drawTaskbar(widget)
Exemplo n.º 4
0
def initWidget(widget):
    global clicked, text2
    text2 = 0
    text = 'This theme demonstrates how to manipulate the \nright click menu option.'
    text += '\nClick the theme with your left mouse button \nto disable and then re-enable the right click menu.'
    karamba.createText(widget,5,5,400,20,text)
    clicked = False
    karamba.redrawWidget(widget)
Exemplo n.º 5
0
def initWidget(widget):
    global clicked, text2
    text2 = 0
    text = 'This theme demonstrates how to manipulate the \nright click menu option.'
    text += '\nClick the theme with your left mouse button \nto disable and then re-enable the right click menu.'
    karamba.createText(widget, 5, 5, 400, 20, text)
    clicked = False
    karamba.redrawWidget(widget)
Exemplo n.º 6
0
	def printTop(self, widget, update):
		if update == 0:
			self.k_MonthCaption = karamba.createText(widget, 25, 17, 200, 50, self.monthString)
			karamba.changeTextColor(widget, self.k_MonthCaption, 255, 255, 255)
			karamba.changeTextSize(widget, self.k_MonthCaption, 20)
			self.k_YearCaption = karamba.createText(widget, 160, 17, 200, 50, self.yearString)
			karamba.changeTextColor(widget, self.k_YearCaption, 255, 255, 255)
			karamba.changeTextSize(widget, self.k_YearCaption, 22)
		else:
			karamba.changeText(widget, self.k_MonthCaption, self.monthString)
			karamba.changeText(widget, self.k_YearCaption, self.yearString)
Exemplo n.º 7
0
    def printEpisodeList(self):

        # Reset text if necessary
        for i in range(len(self.refEpisodeList)):
            # Remove click areas
            karamba.removeClickArea(Applet.widget, self.refEpisodeUrls[i])
            # Remove text
            karamba.deleteText(Applet.widget, self.refEpisodeList[i])
            karamba.deleteText(Applet.widget, self.refEpisodeListWhen[i])
        self.refEpisodeUrls = []
        self.refEpisodeList = []
        self.refEpisodeListWhen = []

        # Write episode list
        for i in range(len(self.episodeList)):
            color = self._processColor(self.episodeList[i]['delta'])

            posTitleY = self.themeHeaderWH[1] + (self.themeBodyWH[1] *
                                                 i) + self.themeBodyTitleXY[1]
            posWhenY = self.themeHeaderWH[1] + (self.themeBodyWH[1] *
                                                i) + self.themeBodyWhenXY[1]

            episodeText = tools.formatEpisode(self.episodeList[i],
                                              self.episodeFormatString)
            refT = karamba.createText(Applet.widget, self.themeBodyTitleXY[0],
                                      posTitleY, self.themeBodyTitleWH[0],
                                      self.themeBodyTitleWH[1], episodeText)
            karamba.changeTextColor(Applet.widget, refT, color[0], color[1],
                                    color[2])
            self.refEpisodeList.append(refT)

            cmd = self.browser.replace("$url$", self.episodeList[i]['url'])
            refUrl = karamba.createClickArea(Applet.widget,
                                             self.themeBodyTitleXY[0],
                                             posTitleY,
                                             self.themeBodyTitleWH[0],
                                             self.themeBodyTitleWH[1], cmd)
            self.refEpisodeUrls.append(refUrl)

            whenText = self._formatWhen(self.episodeList[i]['airdate'],
                                        self.episodeList[i]['delta'])
            refW = karamba.createText(Applet.widget, self.themeBodyWhenXY[0],
                                      posWhenY, self.themeBodyWhenWH[0],
                                      self.themeBodyWhenWH[1], whenText)
            karamba.changeTextColor(Applet.widget, refW, color[0], color[1],
                                    color[2])
            karamba.setTextAlign(Applet.widget, refW, "CENTER")
            karamba.attachClickArea(Applet.widget, refW)
            self.refEpisodeListWhen.append(refW)
Exemplo n.º 8
0
def initWidget(widget):
	global do_nothing_txt
	global do_something_txt

	# display new message
	do_nothing_txt = karamba.createText(widget, 0, 00, 300, 20,
	                                   "Right mouse click me!")
	karamba.changeTextColor(widget, do_nothing_txt, 252,252,252)
	mgmt_txt = karamba.createText(widget, 0, 20, 300, 20,
	                                   "Righ mouse click me too!")
	karamba.changeTextColor(widget, mgmt_txt, 252,252,252)

	karamba.redrawWidget(widget)

	karamba.setWantRightButton(widget, 1)
Exemplo n.º 9
0
def initWidget(widget):
    global do_nothing_txt
    global do_something_txt

    # display new message
    do_nothing_txt = karamba.createText(widget, 0, 00, 300, 20,
                                        "Right mouse click me!")
    karamba.changeTextColor(widget, do_nothing_txt, 252, 252, 252)
    mgmt_txt = karamba.createText(widget, 0, 20, 300, 20,
                                  "Righ mouse click me too!")
    karamba.changeTextColor(widget, mgmt_txt, 252, 252, 252)

    karamba.redrawWidget(widget)

    karamba.setWantRightButton(widget, 1)
Exemplo n.º 10
0
def widgetUpdated(widget):

    global expected_seq  # i hate globals.  please write better code than this example.

    # get the "message"...
    disp = karamba.getIncomingData(widget)
    if disp == "":
        return

    # decode it...
    (seq, x, y, button) = eval(disp)

    # if it's been seen before, skip it...
    if seq <= expected_seq:
        pass

    expected_seq += 1

    message = "seq:%d x:%d y:%d btn:%d" % (seq, x, y, button)
    # delete previous text if exists.
    global drop_txt
    if drop_txt is not None:
        karamba.deleteText(widget, drop_txt)

    # display it...
    drop_txt = karamba.createText(widget, 0, 20, 300, 20, message)
    karamba.changeTextColor(widget, drop_txt, 252, 252, 252)

    karamba.redrawWidget(widget)

    pass
Exemplo n.º 11
0
def initWidget(widget):
	global itempointer, diff, clickScrollUp, clickScrollDown, update, browserCommand
	
	getHeise(heise_url[urlpointer])
	createMenu(widget)

	y_pos = 23
	z = 0 
	while z < lines:
   		itempointer.insert(z ,karamba.createText(widget, 14, y_pos, theme_width-18, line_height, ""))
		setStyle(widget, itempointer[z], 1, 17)
		karamba.changeTextColor(widget, itempointer[z], r,g,b)
		y_pos = y_pos + 15
		z = z + 1
	
	karamba.changeTextColor(widget, fill[0], 54,227,123)
#	karamba.changeTextColor(widget, fill[0], 255,255,255)
	# Menuoption "browser"
	karamba.addMenuConfigOption(widget, "browser", "Change your browser")
	browserCommand = karamba.readConfigEntry(widget, "browser") or "konqueror"
	# Up
	clickScrollUp = karamba.createImage(widget, 0, 0, "up.png")
	karamba.moveImage(widget, clickScrollUp, 50, 2)
	karamba.attachClickArea(widget, clickScrollUp, "")

	#Down
	clickScrollDown = karamba.createImage(widget, 0, 0, "down.png")
	karamba.moveImage(widget, clickScrollDown, 22, 3)
	karamba.attachClickArea(widget, clickScrollDown, "")
	
	fillContent(widget, "refresh")
	update = 0
	widgetUpdated(widget)
Exemplo n.º 12
0
 def show(self):
     # Image
     self.refSplash = karamba.createImage(Applet.widget,
                                          self.splashImageXY[0],
                                          self.splashImageXY[1],
                                          self.splashImage)
     self.splashImageWH = karamba.getImageSize(Applet.widget,
                                               self.refSplash)
     xPos = (Applet.widgetSize[0] - self.splashImageWH[0]) / 2
     self.splashImageXY = (xPos, self.splashImageXY[1])
     karamba.moveImage(Applet.widget, self.refSplash,
                       self.splashImageXY[0], self.splashImageXY[1])
     # Text
     yPos = (self.splashImageXY[1] + self.splashImageWH[1]) + 10
     self.splashTextXY = (0, yPos)
     self.splashTextWH = (Applet.widgetSize[0], 14)
     self.refSplashText = karamba.createText(Applet.widget,
                                             self.splashTextXY[0],
                                             self.splashTextXY[1],
                                             self.splashTextWH[0],
                                             self.splashTextWH[1], "")
     karamba.setTextAlign(Applet.widget, self.refSplashText, "CENTER")
     karamba.changeTextColor(Applet.widget, self.refSplashText, 0xFF,
                             0xFF, 0xFF)
     #
     for i in range(100):
         karamba.redrawWidget(Applet.widget)
Exemplo n.º 13
0
def widgetUpdated(widget):

    global expected_seq # i hate globals.  please write better code than this example.

    # get the "message"...
    disp = karamba.getIncomingData(widget)
    if disp == "":
        return

    # decode it...
    (seq, x, y, button) = eval(disp)

    # if it's been seen before, skip it...
    if seq <= expected_seq:
        pass

    expected_seq += 1

    message = "seq:%d x:%d y:%d btn:%d" % (seq, x, y, button)
    # delete previous text if exists.
    global drop_txt
    if drop_txt is not None:
        karamba.deleteText(widget, drop_txt)

    # display it...
    drop_txt = karamba.createText(widget, 0, 20, 300, 20, message)
    karamba.changeTextColor(widget, drop_txt, 252,252,252)

    karamba.redrawWidget(widget)

    pass
Exemplo n.º 14
0
def initWidget(widget):
    global text
    global button
    text = karamba.createText(widget, 80, 35, 90, 30, status())
    karamba.changeTextSize(widget, text, 16)
    button = karamba.createImage(widget, 60, 90, "imgs/read-request.png")
    karamba.attachClickArea(widget, button, "./launch-viewer.sh", "", "")
    button = karamba.createImage(widget, 140, 90, "imgs/tinyerp-icon.ico")
    karamba.attachClickArea(widget, button, "./launch-ktiny.sh", "", "")
Exemplo n.º 15
0
def itemDropped(widget, dropText, x, y):
	global drop_txt
	# delete previous text if exists.
	if drop_txt is not None:
		karamba.deleteText(widget, drop_txt)

	disp = "x:%d y:%d command: %s" % (x, y, dropText)
	drop_txt = karamba.createText(widget, 10, 40, 500, 20, disp)
	karamba.changeTextColor(widget, drop_txt, 252,252,252)

	karamba.redrawWidget(widget)
Exemplo n.º 16
0
def widgetClicked(widget, x, y, button):
    global clicked,text2
    if clicked and button == 1:
        clicked = False
        karamba.setWantRightButton(widget, False)
        newText = "Enabling the SuperKaramba right click \nconfiguration menu."
        if text2:
            karamba.deleteText(widget,text2)
        text2 = karamba.createText(widget,5,70,400,20,newText)
        print newText
    elif not clicked and button == 1:
        clicked = True
        karamba.setWantRightButton(widget, True)
        newText = "Disabling the SuperKaramba right click \nconfiguration menu."
        if text2:
            karamba.deleteText(widget,text2)
        text2 = karamba.createText(widget,5,70,400,20,newText)
        print newText
    if button == 3:
        print "Clicking the right mouse button is recognized now."
    karamba.redrawWidget(widget)
Exemplo n.º 17
0
def widgetClicked(widget, x, y, button):
    global clicked, text2
    if clicked and button == 1:
        clicked = False
        karamba.setWantRightButton(widget, False)
        newText = "Enabling the SuperKaramba right click \nconfiguration menu."
        if text2:
            karamba.deleteText(widget, text2)
        text2 = karamba.createText(widget, 5, 70, 400, 20, newText)
        print newText
    elif not clicked and button == 1:
        clicked = True
        karamba.setWantRightButton(widget, True)
        newText = "Disabling the SuperKaramba right click \nconfiguration menu."
        if text2:
            karamba.deleteText(widget, text2)
        text2 = karamba.createText(widget, 5, 70, 400, 20, newText)
        print newText
    if button == 3:
        print "Clicking the right mouse button is recognized now."
    karamba.redrawWidget(widget)
Exemplo n.º 18
0
def initWidget(widget):
    global resX
    global numOfTasks
    global taskPanels
    global taskText
    global timeText

    karamba.createImage(widget, resX - 149, 0, "pics/rightend_new.png")
    numOfTasks = (resX - 198 - 149) / 121

    timeText = karamba.createText(widget, resX - 149 + 54, 10, 140, 20, "time")
    karamba.changeTextColor(widget, timeText, 0, 0, 0)
    karamba.changeTextSize(widget, timeText, 9)

    for i in range(numOfTasks):
        taskPanels.append(karamba.createImage(widget, 198 + (121 * i), 3, "pics/task_new.png"))
        taskText.append(karamba.createText(widget, 198 + (121 * i) + 9, 9, 100, 20, ""))

    for text in taskText:
        karamba.changeTextSize(widget, text, 9)

    drawTaskbar(widget)
Exemplo n.º 19
0
	def printDayCaptions(self, widget, update):
		if update != 0:
			i = 0
			while i <= 6:
				karamba.deleteText(widget, self.k_dayCaption[i])
				i = i + 1
		i = 0
		while i <= 6:
			self.k_dayCaption[i] = karamba.createText(widget, self.xPosition[i], 50, 200, 50, self.dayArray[i])
			karamba.changeTextFont(widget, self.k_dayCaption[i], "arialbd")
			karamba.changeTextColor(widget, self.k_dayCaption[i], 255, 255, 255)
			i = i + 1
		karamba.changeTextColor(widget, self.k_dayCaption[self.thisWeekday], 255, 255 , 255)
Exemplo n.º 20
0
def widgetClicked(widget, x, y, button):
	global do_nothing_txt

	if y < 20:
		if do_nothing_txt is not None:
			karamba.deleteText(widget, do_nothing_txt)
			do_nothing_txt = karamba.createText(widget,
			        0, 0, 300, 20, "I don't do anything when clicking here.")
			karamba.changeTextColor(widget, do_nothing_txt,
			                         255,200,200)
			karamba.redrawWidget(widget)
			return

	karamba.managementPopup(widget)
Exemplo n.º 21
0
def widgetClicked(widget, x, y, button):
    global do_nothing_txt

    if y < 20:
        if do_nothing_txt is not None:
            karamba.deleteText(widget, do_nothing_txt)
            do_nothing_txt = karamba.createText(
                widget, 0, 0, 300, 20,
                "I don't do anything when clicking here.")
            karamba.changeTextColor(widget, do_nothing_txt, 255, 200, 200)
            karamba.redrawWidget(widget)
            return

    karamba.managementPopup(widget)
Exemplo n.º 22
0
def create_text(widget, line, depth, disp, name=None, command=None, icon=None):

    x = depth * 30
    y = line * 7
    width = 400
    height = 8
    drop_txt = karamba.createText(widget, x, y, width, height, disp)
    karamba.changeTextSize(widget, drop_txt, 7)
    karamba.changeTextColor(widget, drop_txt, 252, 252, 252)

    # create a (very narrow!  only an 8-pixel-high area!)
    # service click area to demonstrate that commands get
    # executed correctly.

    if name:
        karamba.createServiceClickArea(widget, x, y, width, height, name,
                                       command, icon)
Exemplo n.º 23
0
def create_text(widget, line, depth, disp, name=None, command=None, icon=None):

    x = depth*30
    y = line*7
    width = 400
    height = 8
    drop_txt = karamba.createText(widget, x, y, width, height, disp)
    karamba.changeTextSize(widget, drop_txt, 7)
    karamba.changeTextColor(widget, drop_txt, 252,252,252)

    # create a (very narrow!  only an 8-pixel-high area!)
    # service click area to demonstrate that commands get
    # executed correctly.

    if name:
        karamba.createServiceClickArea( widget,
                                        x,y,width,height,
                         name, command, icon)
Exemplo n.º 24
0
	def printCalendar(self, widget, update):
		if update != 0:
			j = 0
			while j <= 4:
				i = 0
				while i <= 6:
					karamba.deleteText(widget, self.k_dayField[j][i])
					i = i + 1
				j = j + 1
		j = 0
		while j <= 4:
			i = 0
			while i <= 6:
				self.k_dayField[j][i] = karamba.createText(widget, self.xPosition[i], 	self.yPosition[j], 200, 50, str(self.calendarArray[j][i]))
				karamba.changeTextColor(widget, self.k_dayField[j][i], 255, 255, 255)
				karamba.changeTextFont(widget, self.k_dayField[j][i], "Arial")
				if self.calendarArray[j][i] == 0:
					karamba.hideText(widget, self.k_dayField[j][i])
				i = i + 1
			j = j + 1
Exemplo n.º 25
0
 def show(self):
     # Image
     self.refSplash     = karamba.createImage(Applet.widget, self.splashImageXY[0], self.splashImageXY[1], self.splashImage)
     self.splashImageWH = karamba.getImageSize(Applet.widget, self.refSplash)
     xPos = ( Applet.widgetSize[0] - self.splashImageWH[0] ) / 2
     self.splashImageXY = ( xPos, self.splashImageXY[1] )
     karamba.moveImage( Applet.widget, self.refSplash, self.splashImageXY[0], self.splashImageXY[1] )
     # Text
     yPos = ( self.splashImageXY[1] + self.splashImageWH[1] ) + 10
     self.splashTextXY  = ( 0, yPos )
     self.splashTextWH  = ( Applet.widgetSize[0], 14 )
     self.refSplashText = karamba.createText( Applet.widget,
                                              self.splashTextXY[0],
                                              self.splashTextXY[1],
                                              self.splashTextWH[0],
                                              self.splashTextWH[1],
                                              "" )
     karamba.setTextAlign(Applet.widget, self.refSplashText, "CENTER")
     karamba.changeTextColor(Applet.widget, self.refSplashText, 0xFF, 0xFF, 0xFF)
     #
     for i in range(100): karamba.redrawWidget(Applet.widget)
Exemplo n.º 26
0
def widgetUpdated(widget):
	global seq
	global text

	seq -= 1

	if seq <= 0:
		karamba.changeInterval(widget, 1000)

	if seq <= 0:
		message = "biding-time seq:%d" % -seq
	else:
		message = "wiggle seq:%d" % seq

	# delete previous text if exists.
	if text is not None:
		karamba.deleteText(widget, text)

	# display new message
	text = karamba.createText(widget, 0, 20, 300, 20, message)
	karamba.changeTextColor(widget, text, 252,252,252)

	karamba.redrawWidget(widget)
Exemplo n.º 27
0
def widgetUpdated(widget):
    global seq
    global text

    seq -= 1

    if seq <= 0:
        karamba.changeInterval(widget, 1000)

    if seq <= 0:
        message = "biding-time seq:%d" % -seq
    else:
        message = "wiggle seq:%d" % seq

    # delete previous text if exists.
    if text is not None:
        karamba.deleteText(widget, text)

    # display new message
    text = karamba.createText(widget, 0, 20, 300, 20, message)
    karamba.changeTextColor(widget, text, 252, 252, 252)

    karamba.redrawWidget(widget)
Exemplo n.º 28
0
def widgetUpdated(widget):
    global texts, b, a

    b = (b + 1) % 2

    # Create & delete
    if texts[0]:
        karamba.deleteText(widget, texts[0])
        texts[0] = 0
    else:
        texts[0] = karamba.createText(widget, 0, 20, 200, 20, "Text meter")

    # size & resize
    size = karamba.getTextSize(widget, texts[1])
    print "getTextSize: " + str(size)
    size = ((b * 200) + 200, size[1])
    karamba.resizeText(widget, texts[1], size[0], size[1])

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

    # Hide & Show
    if b:
        karamba.hideText(widget, texts[3])
    else:
        karamba.showText(widget, texts[3])

    # Sensor
    sensor = karamba.getTextSensor(widget, texts[4])
    print "getSensor: " + str(sensor)
    if b:
        karamba.setTextSensor(widget, texts[4], 'SENSOR=SENSOR TYPE="cpu_temp"')
    else:
        karamba.setTextSensor(widget, texts[4], "SENSOR=CPU")

    # Value
    v = karamba.getTextValue(widget, texts[5])
    print "getTextValue: ", v
    v += "."
    karamba.changeText(widget, texts[5], v)

    # Shadow
    v = karamba.getTextShadow(widget, texts[6])
    print "getTextShadow: ", v
    v = (v + 1) % 10
    karamba.changeTextShadow(widget, texts[6], v)

    # Font size
    v = karamba.getTextFontSize(widget, texts[7])
    print "getTextFontSize: ", v
    v = 10 + ((v - 10) + 1) % 10
    karamba.changeTextSize(widget, texts[7], v)

    # Text color
    v = karamba.getTextColor(widget, texts[8])
    print "getTextColor: ", v
    karamba.changeTextColor(widget, texts[8], b * 255, b * 255, b * 255)

    # Text Font
    v = karamba.getTextFont(widget, texts[9])
    print "getTextFont: ", v
    if b:
        v = "Bitstream Vera Sans"
    else:
        v = "Bitstream Vera Serif"
    karamba.changeTextFont(widget, texts[9], v)

    # Text Alignment
    a = (a + 1) % 3
    v = karamba.getTextAlign(widget, texts[10])
    print "getTextAlign: ", v
    karamba.setTextAlign(widget, texts[10], align[a])
Exemplo n.º 29
0
def widgetUpdated(widget):
    global texts, b, a

    b = (b + 1) % 2

    # Create & delete
    if (texts[0]):
        karamba.deleteText(widget, texts[0])
        texts[0] = 0
    else:
        texts[0] = karamba.createText(widget, 0, 20, 200, 20, "Text meter")

    # size & resize
    size = karamba.getTextSize(widget, texts[1])
    print "getTextSize: " + str(size)
    size = ((b * 200) + 200, size[1])
    karamba.resizeText(widget, texts[1], size[0], size[1])

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

    # Hide & Show
    if (b):
        karamba.hideText(widget, texts[3])
    else:
        karamba.showText(widget, texts[3])

    # Sensor
    sensor = karamba.getTextSensor(widget, texts[4])
    print "getSensor: " + str(sensor)
    if (b):
        karamba.setTextSensor(widget, texts[4],
                              'SENSOR=SENSOR TYPE="cpu_temp"')
    else:
        karamba.setTextSensor(widget, texts[4], 'SENSOR=CPU')

    # Value
    v = karamba.getTextValue(widget, texts[5])
    print "getTextValue: ", v
    v += '.'
    karamba.changeText(widget, texts[5], v)

    # Shadow
    v = karamba.getTextShadow(widget, texts[6])
    print "getTextShadow: ", v
    v = (v + 1) % 10
    karamba.changeTextShadow(widget, texts[6], v)

    # Font size
    v = karamba.getTextFontSize(widget, texts[7])
    print "getTextFontSize: ", v
    v = 10 + ((v - 10) + 1) % 10
    karamba.changeTextSize(widget, texts[7], v)

    # Text color
    v = karamba.getTextColor(widget, texts[8])
    print "getTextColor: ", v
    karamba.changeTextColor(widget, texts[8], b * 255, b * 255, b * 255)

    # Text Font
    v = karamba.getTextFont(widget, texts[9])
    print "getTextFont: ", v
    if (b):
        v = 'Bitstream Vera Sans'
    else:
        v = 'Bitstream Vera Serif'
    karamba.changeTextFont(widget, texts[9], v)

    # Text Alignment
    a = (a + 1) % 3
    v = karamba.getTextAlign(widget, texts[10])
    print "getTextAlign: ", v
    karamba.setTextAlign(widget, texts[10], align[a])