Esempio n. 1
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)
Esempio n. 2
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
Esempio n. 3
0
def setStyle(widget, text, shadow, size):
	karamba.changeTextSize(widget, text, size)
	karamba.changeTextFont(widget, text, "arialbd")
	karamba.changeTextShadow(widget, text, shadow)
Esempio n. 4
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])
Esempio n. 5
0
    titletext_size = karamba.readConfigEntry(widget, "titletext_size")
    if titletext_size == None or int(titletext_size) < 1:
        try:
            titletext_size = theme_cfg.getint("karamba", "titletext_size")
            karamba.changeTextSize(widget, titletext, int(titletext_size))
        except ConfigParser.NoOptionError, (strerror):
            print "Warning: " + str(strerror) + ". Using default."
    else:
        karamba.changeTextSize(widget, titletext, int(titletext_size))

    titletext_font = karamba.readConfigEntry(widget, "titletext_font")
    if titletext_font == None or str(titletext_font) == "":
        try:
            titletext_font = theme_cfg.get("karamba", "titletext_font")
            karamba.changeTextFont(widget, titletext, titletext_font.strip())
        except ConfigParser.NoOptionError, (strerror):
            print "Warning: " + str(strerror) + ". Using default."
    else:
        karamba.changeTextFont(widget, titletext, titletext_font.strip())


def readConfigTopText(widget, theme_cfg):
    toptext = karamba.getThemeText(widget, "toptext")

    #### Read the toptext x and y position from the config file ####
    # required option
    try:
        x, y = theme_cfg.get("karamba", "toptext_pos").split(",", 1)
        karamba.moveText(widget, toptext, int(x), int(y))
    except ConfigParser.NoOptionError, (strerror):
Esempio n. 6
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])
Esempio n. 7
0
	titletext_size = karamba.readConfigEntry(widget, "titletext_size")
	if titletext_size == None or int(titletext_size) < 1:
		try:
			titletext_size = theme_cfg.getint( "karamba", "titletext_size" )
			karamba.changeTextSize(widget, titletext, int(titletext_size))
		except ConfigParser.NoOptionError, (strerror):
			print "Warning: " + str(strerror) + ". Using default."
	else:
		karamba.changeTextSize(widget, titletext, int(titletext_size))

	titletext_font = karamba.readConfigEntry(widget, "titletext_font")
	if titletext_font == None or str(titletext_font) == "":
		try:
			titletext_font = theme_cfg.get( "karamba", "titletext_font" )
			karamba.changeTextFont(widget, titletext, titletext_font.strip())
		except ConfigParser.NoOptionError, (strerror):
			print "Warning: " + str(strerror) + ". Using default."
	else:
		karamba.changeTextFont(widget, titletext, titletext_font.strip())

def readConfigTopText(widget, theme_cfg):
	toptext = karamba.getThemeText(widget, "toptext")

	#### Read the toptext x and y position from the config file ####
	# required option
	try:
		x, y = theme_cfg.get( "karamba", "toptext_pos" ).split(",", 1 )
		karamba.moveText(widget, toptext, int(x), int(y))
	except ConfigParser.NoOptionError, (strerror):
		displayError('Top Text', 'Missing parameters for the position of the process listing text.')