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)
def initWidget(widget): global input, output #input = karamba.getThemeInputBox(widget, "input01") input = karamba.createInputBox(widget, 0, 0, 50, 20, "foo") output = karamba.getThemeText(widget, "output01") karamba.changeTextColor(widget, output, 0, 0, 0) karamba.changeTextSize(widget, output, 10) karamba.redrawWidget(widget)
def initWidget(widget): global input, output #input = karamba.getThemeInputBox(widget, "input01") input = karamba.createInputBox(widget,0,0,50,20,"foo") output = karamba.getThemeText(widget, "output01") karamba.changeTextColor(widget, output, 0, 0, 0) karamba.changeTextSize(widget, output, 10) karamba.redrawWidget(widget)
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", "", "")
def initWidget(widget): global input1, input2, output, fontSize #input = karamba.getThemeInputBox(widget, "input01") input1 = karamba.createInputBox(widget,0,0,50,20,"foo") input2 = karamba.createInputBox(widget,0,30,50,20,"bar") fontSize = karamba.getInputBoxFontSize(widget, input2) output = karamba.getThemeText(widget, "output01") karamba.changeTextColor(widget, output, 0, 0, 0) karamba.changeTextSize(widget, output, 10) karamba.redrawWidget(widget)
def initWidget(widget): global input1, input2, output, fontSize #input = karamba.getThemeInputBox(widget, "input01") input1 = karamba.createInputBox(widget, 0, 0, 50, 20, "foo") input2 = karamba.createInputBox(widget, 0, 30, 50, 20, "bar") fontSize = karamba.getInputBoxFontSize(widget, input2) output = karamba.getThemeText(widget, "output01") karamba.changeTextColor(widget, output, 0, 0, 0) karamba.changeTextSize(widget, output, 10) karamba.redrawWidget(widget)
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)
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)
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)
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)
def setStyle(widget, text, shadow, size): karamba.changeTextSize(widget, text, size) karamba.changeTextFont(widget, text, "arialbd") karamba.changeTextShadow(widget, text, shadow)
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])
titletext_shadow = karamba.readConfigEntry(widget, "titletext_shadow") if titletext_shadow == None or str(titletext_shadow) == "": try: titletext_shadow = theme_cfg.getint("karamba", "titletext_shadow") karamba.changeTextShadow(widget, titletext, int(titletext_shadow)) except ConfigParser.NoOptionError, (strerror): print "Warning: " + str(strerror) + ". Using default." else: karamba.changeTextShadow(widget, titletext, int(titletext_shadow)) 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 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])
titletext_shadow = karamba.readConfigEntry(widget, "titletext_shadow") if titletext_shadow == None or str(titletext_shadow) == "": try: titletext_shadow = theme_cfg.getint( "karamba", "titletext_shadow" ) karamba.changeTextShadow(widget, titletext, int(titletext_shadow)) except ConfigParser.NoOptionError, (strerror): print "Warning: " + str(strerror) + ". Using default." else: karamba.changeTextShadow(widget, titletext, int(titletext_shadow)) 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())