def widgetUpdated(widget): global timeText karamba.changeText( widget, timeText, time.strftime("%I:%M %p %a", time.localtime(time.time()))) karamba.redrawWidget(widget)
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)
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
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
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)
def refreshWhenColumn(self): for i in range(len(self.episodeList)): whenText = self._formatWhen(self.episodeList[i]['airdate'], self.episodeList[i]['delta']) karamba.changeText(Applet.widget, self.refEpisodeListWhen[i], whenText) karamba.redrawWidget(Applet.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 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)
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)
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): # this resets the text to "" so we know we've never # received anything yet from the other theme name = karamba.getPrettyThemeName(widget) print "2.py name: ", name karamba.setIncomingData(widget, name, "") karamba.redrawWidget(widget)
def initWidget(widget): # this resets the text to "" so we know we've never # received anything yet from the other theme name = karamba.getPrettyThemeName(widget) print "2.py name: ", name karamba.setIncomingData(widget, name, "") 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 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 drawBackground(self): self._readThemeInfos(self.themeName) # Reset background (delete images) for imgRef in self.refBgndImages: karamba.deleteImage(Applet.widget, imgRef) self.refBgndImages = [] # Header ref = karamba.createBackgroundImage(Applet.widget, 0, 0, self.themeHeaderImg) self.themeHeaderWH = karamba.getImageSize(Applet.widget, ref) self.refBgndImages.append(ref) # Header's text self.refHeaderTitle = karamba.createRichText(Applet.widget, self.themeHeaderTxtTitle, 0) karamba.moveRichText(Applet.widget, self.refHeaderTitle, self.themeHeaderTxtTitleXY[0], self.themeHeaderTxtTitleXY[1]) karamba.setRichTextWidth(Applet.widget, self.refHeaderTitle, self.themeHeaderTxtTitleWH[0]) self.refHeaderWhen = karamba.createRichText(Applet.widget, self.themeHeaderTxtWhen, 0) karamba.moveRichText(Applet.widget, self.refHeaderWhen, self.themeHeaderTxtWhenXY[0], self.themeHeaderTxtWhenXY[1]) karamba.setRichTextWidth(Applet.widget, self.refHeaderWhen, self.themeHeaderTxtWhenWH[0]) #--- # Applet must display at least 1 line posY = self.themeHeaderWH[1] ref = karamba.createBackgroundImage(Applet.widget, 0, posY, self.themeBodyImg) self.themeBodyWH = karamba.getImageSize(Applet.widget, ref) self.refBgndImages.append(ref) # Display other lines... for i in range(1, self.themeLines): posY += self.themeBodyWH[1] ref = karamba.createBackgroundImage(Applet.widget, 0, posY, self.themeBodyImg) self.refBgndImages.append(ref) # Footer posY += self.themeBodyWH[1] ref = karamba.createBackgroundImage(Applet.widget, 0, posY, self.themeFooterImg) self.themeFooterWH = karamba.getImageSize(Applet.widget, ref) self.refBgndImages.append(ref) # Change widget size Applet.widgetSize = (Applet.widgetSize[0], posY + self.themeFooterWH[1]) karamba.resizeWidget(Applet.widget, Applet.widgetSize[0], Applet.widgetSize[1]) karamba.redrawWidgetBackground(Applet.widget) karamba.redrawWidget(Applet.widget)
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)
def keyPressed(widget, meter, char): global input, output if meter == input: print "keyPressed: key= '", char, "'" text = karamba.getInputBoxValue(widget, input) karamba.changeText(widget, output, "Searched: " + text) try: if ord(char) == 13: # Enter url = "konqueror leo:" + text os.system(url + "&") except TypeError: print "There was a type error" karamba.redrawWidget(widget)
def keyPressed(widget, meter, char): global input, output if meter == input: print "keyPressed: key= '", char, "'" text = karamba.getInputBoxValue(widget, input) karamba.changeText(widget, output, "Searched: " + text) try: if ord(char) == 13: # Enter url = "konqueror leo:" + text os.system(url + "&") except TypeError: print "There was a type error" karamba.redrawWidget(widget)
def initWidget(widget): global richtext global penguin karamba.resizeWidget(widget, 360, 520) penguin = karamba.createImage( widget, 250, 150, karamba.getThemePath(widget) + "/penguin_executive.png") karamba.hideImage(widget, penguin) text = """ <h1>Richtext Example</h1> <p>A rich text object allows to display a string interpreted as rich text. To create a rich text object use the command:<br> <p align="center">karamba.createRichText(widget, text)</p> A simple subset of <a href="kfmclient openURL http://www.selfhtml.org"><font color="black"><i>HTML</i></font></a>-tags is used to encode the formatting commands.</p> <p><font size=+2>Some features:</font> <ul> <li>Numbered and unnumbered lists</li> <li>Inline Images <img src=\"""" + karamba.getThemePath( widget) + u"""info.png\"</li> <li>Various <font color="red">different</font><font color="blue"> text</font><font color="green"> colours</font></li> <li>Hyperlinks: <a href="kfmclient openURL http://netdragon.sourceforge.net"> Superkaramba Homepage</a></li> <li>Links can also <a href="#trigger">trigger</a> actions in the script</li> <li><i>Various</i> <b>different</b> <u>caracter</u> <s>styles</s></li> <li><a href="kfmclient openURL http://www.unicode.org">Unicode</a>: \u03B6 \u03B3 \u03BB \u03A3 \u03A9 </li> <li>Simple Tables: <table bgcolor="darkgray" border="1" width="80%"> <tr><th colspan="3">Header</th></tr> <tr><td>Cell (1,1)</td><td>Cell (1,2)</td><td>Cell (1,3)</td><tr> <tr><td>Cell (2,1)</td><td>Cell (2,2)</td><td>Cell (2,3)</td><tr> </table></li> </ul> For a complete documentation of all supported tags look at: <a href="kfmclient openURL http://doc.trolltech.com/3.0/qstylesheet.html"> http://doc.trolltech.com/3.0/qstylesheet.html</a>. </p><br> """ richtext = karamba.createRichText(widget, text) karamba.moveRichText(widget, richtext, 10, 10) print "richText Size = ", karamba.getRichTextSize(widget, richtext) karamba.setRichTextWidth(widget, richtext, 345) #karamba.deleteRichText(widget, richtext) karamba.redrawWidget(widget)
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)
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)
def initWidget(widget): global richtext global penguin karamba.resizeWidget(widget, 360, 520) penguin = karamba.createImage(widget, 250, 150, karamba.getThemePath(widget) + "/penguin_executive.png") karamba.hideImage(widget, penguin) text = """ <h1>Richtext Example</h1> <p>A rich text object allows to display a string interpreted as rich text. To create a rich text object use the command:<br> <p align="center">karamba.createRichText(widget, text)</p> A simple subset of <a href="kfmclient openURL http://www.selfhtml.org"><font color="black"><i>HTML</i></font></a>-tags is used to encode the formatting commands.</p> <p><font size=+2>Some features:</font> <ul> <li>Numbered and unnumbered lists</li> <li>Inline Images <img src=\"""" + karamba.getThemePath(widget) + u"""info.png\"</li> <li>Various <font color="red">different</font><font color="blue"> text</font><font color="green"> colours</font></li> <li>Hyperlinks: <a href="kfmclient openURL http://netdragon.sourceforge.net"> Superkaramba Homepage</a></li> <li>Links can also <a href="#trigger">trigger</a> actions in the script</li> <li><i>Various</i> <b>different</b> <u>caracter</u> <s>styles</s></li> <li><a href="kfmclient openURL http://www.unicode.org">Unicode</a>: \u03B6 \u03B3 \u03BB \u03A3 \u03A9 </li> <li>Simple Tables: <table bgcolor="darkgray" border="1" width="80%"> <tr><th colspan="3">Header</th></tr> <tr><td>Cell (1,1)</td><td>Cell (1,2)</td><td>Cell (1,3)</td><tr> <tr><td>Cell (2,1)</td><td>Cell (2,2)</td><td>Cell (2,3)</td><tr> </table></li> </ul> For a complete documentation of all supported tags look at: <a href="kfmclient openURL http://doc.trolltech.com/3.0/qstylesheet.html"> http://doc.trolltech.com/3.0/qstylesheet.html</a>. </p><br> """ richtext = karamba.createRichText(widget, text) karamba.moveRichText(widget, richtext, 10, 10) print "richText Size = ", karamba.getRichTextSize(widget, richtext) karamba.setRichTextWidth(widget, richtext, 345) #karamba.deleteRichText(widget, richtext) karamba.redrawWidget(widget)
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)
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)
def meterClicked(widget, meter, button): global penguin global penguin_hidden global richtext print "Meter clicked", meter if meter == "trigger": if penguin_hidden: karamba.showImage(widget, penguin) penguin_hidden = 0 else: karamba.hideImage(widget, penguin) penguin_hidden = 1 if meter == "delete": karamba.deleteRichText(widget, richtext) karamba.redrawWidget(widget)
def widgetUpdated(widget): """ This is called every time the widget is updated. The update interval is specified in the .theme file """ global active global raised_alarm stopwatchmode = (zerotime.time < alarmtime.time) if active == 1: # increment/decrement, depending on mode if stopwatchmode: stepmethod = curtime.increment else: stepmethod = curtime.decrement try: stepmethod() except ValueError: # stop, instead of going below zero print "caught time going below zero" meterClicked(widget, endButton, 1) # reflect new time in GUI showTime(widget, curtime) if stopwatchmode: karamba.setBarValue(widget, progressBar, curtime.time) else: karamba.setBarValue(widget, progressBar, \ alarmtime.time + zerotime.time - curtime.time) karamba.redrawWidget(widget) # write current time to file curtimefh = open(curtimefile, "w") curtimefh.write(str(curtime)) curtimefh.close() # alarm? if not raised_alarm: if (stopwatchmode and (curtime.time >= alarmtime.time)) \ or (not stopwatchmode and (curtime.time <= alarmtime.time)): karamba.showImage(widget, done) karamba.redrawWidget(widget) alarm(widget) raised_alarm = True
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)
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)
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)
def drawBackground(self): self._readThemeInfos(self.themeName) # Reset background (delete images) for imgRef in self.refBgndImages: karamba.deleteImage(Applet.widget, imgRef) self.refBgndImages = [] # Header ref = karamba.createBackgroundImage(Applet.widget, 0, 0, self.themeHeaderImg) self.themeHeaderWH = karamba.getImageSize(Applet.widget, ref) self.refBgndImages.append(ref) # Header's text self.refHeaderTitle = karamba.createRichText(Applet.widget, self.themeHeaderTxtTitle, 0) karamba.moveRichText(Applet.widget, self.refHeaderTitle, self.themeHeaderTxtTitleXY[0], self.themeHeaderTxtTitleXY[1]) karamba.setRichTextWidth(Applet.widget, self.refHeaderTitle, self.themeHeaderTxtTitleWH[0]) self.refHeaderWhen = karamba.createRichText(Applet.widget, self.themeHeaderTxtWhen, 0) karamba.moveRichText(Applet.widget, self.refHeaderWhen, self.themeHeaderTxtWhenXY[0], self.themeHeaderTxtWhenXY[1]) karamba.setRichTextWidth(Applet.widget, self.refHeaderWhen, self.themeHeaderTxtWhenWH[0]) #--- # Applet must display at least 1 line posY = self.themeHeaderWH[1] ref = karamba.createBackgroundImage(Applet.widget, 0, posY, self.themeBodyImg) self.themeBodyWH = karamba.getImageSize(Applet.widget, ref) self.refBgndImages.append(ref) # Display other lines... for i in range(1, self.themeLines): posY += self.themeBodyWH[1] ref = karamba.createBackgroundImage(Applet.widget, 0, posY, self.themeBodyImg) self.refBgndImages.append(ref) # Footer posY += self.themeBodyWH[1] ref = karamba.createBackgroundImage(Applet.widget, 0, posY, self.themeFooterImg) self.themeFooterWH = karamba.getImageSize(Applet.widget, ref) self.refBgndImages.append(ref) # Change widget size Applet.widgetSize = ( Applet.widgetSize[0], posY + self.themeFooterWH[1] ) karamba.resizeWidget( Applet.widget, Applet.widgetSize[0], Applet.widgetSize[1] ) karamba.redrawWidgetBackground(Applet.widget) karamba.redrawWidget(Applet.widget)
def widgetUpdated(widget): global input1, input2, i, fontSize #Change the font in the input box if i == 0: karamba.changeInputBoxFont(widget, input1, "times") karamba.changeInputBoxFontColor(widget, input1, 0, 0, 0) karamba.changeInputBoxBackgroundColor(widget, input1, 255, 255, 255) karamba.changeInputBoxFrameColor(widget, input2, 0, 0, 255) karamba.changeInputBoxFontSize(widget, input2, fontSize) else: karamba.changeInputBoxFont(widget, input1, "luxi sans") karamba.changeInputBoxFontColor(widget, input1, 255, 0, 0) karamba.changeInputBoxBackgroundColor(widget, input1, 0, 0, 0) karamba.changeInputBoxFrameColor(widget, input2, 255, 255, 255) karamba.changeInputBoxFontSize(widget, input2, 14) i += 1 if i == 2: i = 0 karamba.redrawWidget(widget)
def widgetUpdated(widget): global input1, input2, i, fontSize #Change the font in the input box if i == 0: karamba.changeInputBoxFont(widget, input1, "times" ) karamba.changeInputBoxFontColor(widget, input1, 0, 0, 0) karamba.changeInputBoxBackgroundColor(widget, input1, 255,255,255) karamba.changeInputBoxFrameColor(widget, input2, 0, 0, 255) karamba.changeInputBoxFontSize(widget, input2, fontSize) else: karamba.changeInputBoxFont(widget, input1, "luxi sans" ) karamba.changeInputBoxFontColor(widget, input1, 255, 0, 0) karamba.changeInputBoxBackgroundColor(widget, input1, 0, 0, 0) karamba.changeInputBoxFrameColor(widget, input2, 255, 255, 255) karamba.changeInputBoxFontSize(widget, input2, 14) i += 1 if i == 2: i = 0 karamba.redrawWidget(widget)
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)
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)
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
def initWidget(widget): karamba.redrawWidget(widget)
def widgetUpdated(widget): global Instances id = karamba.readConfigEntry(widget, "id") Instances[id].start() karamba.redrawWidget(widget)
def refreshWhenColumn(self): for i in range( len( self.episodeList ) ): whenText = self._formatWhen( self.episodeList[i]['airdate'], self.episodeList[i]['delta'] ) karamba.changeText(Applet.widget, self.refEpisodeListWhen[i], whenText) karamba.redrawWidget(Applet.widget)
def drawTaskbar(widget): global taskPanels global taskText global numOfTasks taskList = karamba.getTaskList(widget) for image in taskPanels: karamba.hideImage(widget, image) for text in taskText: karamba.changeText(widget, text, "") karamba.changeTextShadow(widget, text, 0) karamba.changeTextColor(widget, text, 0, 0, 0) length = len(taskList) if numOfTasks < length: length = numOfTasks knownGroups = {} groups = [] groupRefs = {} activeGroup = 0 groupCount = 0 # build groups list that contains sub-lists of taskInfo sorted by group for j in range(len(taskList)): taskinfo = karamba.getTaskInfo(widget, taskList[j]) if knownGroups.has_key(taskinfo[2]) == 0: groupCount = groupCount + 1 if taskinfo[7] == 1: activeGroup = groupCount knownGroups[taskinfo[2]] = 1 thisGroup = [] thisGroup.append(taskinfo) groupRefs[taskinfo[2]] = len(groups) groups.append(thisGroup) else: if taskinfo[7] == 1: activeGroup = groupRefs[taskinfo[2]] + 1 knownGroups[taskinfo[2]] = knownGroups[taskinfo[2]] + 1 thisGroup = groups[groupRefs[taskinfo[2]]] thisGroup.append(taskinfo) # fill out the task bar j = 0 for group in groups: # safety check (could be more task groups than bar is long) if j < length: karamba.showImage(widget, taskPanels[j]) if len(group) != 1: karamba.changeText(widget, taskText[j], group[0][2] + " [" + str(len(group)) + "]") else: karamba.changeText(widget, taskText[j], (group[0][0])) j = j + 1 if activeGroup != 0: karamba.changeTextShadow(widget, taskText[activeGroup - 1], 1) karamba.changeTextColor(widget, taskText[activeGroup - 1], 239, 220, 11) karamba.redrawWidget(widget)
def widgetUpdated(widget): karamba.redrawWidget(widget)
def widgetUpdated(widget): karamba.redrawWidget(widget)
def widgetUpdated(widget): global Instances id = karamba.readConfigEntry(widget, "id") Instances[id].start() karamba.redrawWidget(widget)
def drawTaskbar(widget): global taskPanels global taskText global numOfTasks taskList = karamba.getTaskList(widget) for image in taskPanels: karamba.hideImage(widget, image) for text in taskText: karamba.changeText(widget, text, "") karamba.changeTextShadow(widget, text, 0) karamba.changeTextColor(widget, text, 0, 0, 0) length = len(taskList) if (numOfTasks < length): length = numOfTasks knownGroups = {} groups = [] groupRefs = {} activeGroup = 0 groupCount = 0 #build groups list that contains sub-lists of taskInfo sorted by group for j in range(len(taskList)): taskinfo = karamba.getTaskInfo(widget, taskList[j]) if knownGroups.has_key(taskinfo[2]) == 0: groupCount = groupCount + 1 if (taskinfo[7] == 1): activeGroup = groupCount knownGroups[taskinfo[2]] = 1 thisGroup = [] thisGroup.append(taskinfo) groupRefs[taskinfo[2]] = len(groups) groups.append(thisGroup) else: if (taskinfo[7] == 1): activeGroup = groupRefs[taskinfo[2]] + 1 knownGroups[taskinfo[2]] = knownGroups[taskinfo[2]] + 1 thisGroup = groups[groupRefs[taskinfo[2]]] thisGroup.append(taskinfo) #fill out the task bar j = 0 for group in groups: #safety check (could be more task groups than bar is long) if (j < length): karamba.showImage(widget, taskPanels[j]) if len(group) != 1: karamba.changeText(widget, taskText[j], group[0][2] + " [" + str(len(group)) + "]") else: karamba.changeText(widget, taskText[j], (group[0][0])) j = j + 1 if (activeGroup != 0): karamba.changeTextShadow(widget, taskText[activeGroup - 1], 1) karamba.changeTextColor(widget, taskText[activeGroup - 1], 239, 220, 11) karamba.redrawWidget(widget)
def initWidget(widget): karamba.acceptDrops(widget) karamba.redrawWidget(widget)
def hide(self): karamba.deleteText(Applet.widget, self.refSplashText) karamba.deleteImage(Applet.widget, self.refSplash) for i in range(100): karamba.redrawWidget(Applet.widget)
def setText(self, text): karamba.changeText(Applet.widget, self.refSplashText, text) for i in range(100): karamba.redrawWidget(Applet.widget)
def widgetUpdated(widget): global timeText karamba.changeText(widget, timeText, time.strftime("%I:%M %p %a", time.localtime(time.time()))) karamba.redrawWidget(widget)
def initWidget(widget): display_svc_group(widget, "", 0, 0) karamba.redrawWidget(widget)
def initWidget(widget): display_svc_group(widget, "", 0, 0) karamba.redrawWidget(widget)
def widgetUpdated(widget): global init global linkePupille global rechtePupille global w_width global w_height global w_x global w_y global lx global ly global la global lb global lp_width global lp_height global rx global ry global ra global rb global rp_width global rp_height global x_old global y_old if init == 0: theme_path = karamba.getThemePath(widget) + "/" # read widget coordinates from eyes.theme # f = open(theme_path + "eyes.theme") # karamba_line = "" #while re.compile('KARAMBA').search(karamba_line) == None: # karamba_line = f.readline() #w_x = int(re.compile('X=([0-9]+)').search(karamba_line).group(1)) #w_y = int(re.compile('Y=([0-9]+)').search(karamba_line).group(1)) #f.close() #karamba.createWidgetMask(widget, theme_path + "pics/mask.png") linkePupille = karamba.createImage(widget, 15, 30, theme_path + "pics/pupille.png") rechtePupille = karamba.createImage(widget, 100, 30, theme_path + "pics/pupille.png") init = 1 karamba.redrawWidget(widget) # query mouse-cursor position x, y = xcursor.position() #fp = os.popen("./xpos") #output = fp.read() #x, y = output.split() #print x, y if x != x_old or y != y_old: x_old, y_old = x, y # Get Widget Position w_x, w_y = karamba.getWidgetPosition(widget) # Calc left pupille xp, yp = pupille(int(x), int(y), lx, ly, la, lb, w_x, w_y) xp = xp - lp_width / 2 yp = yp - lp_height / 2 #print xp, yp karamba.moveImage(widget, linkePupille, xp, yp) # Calc right pupille xp, yp = pupille(int(x), int(y), rx, ry, ra, rb, w_x, w_y) xp = xp - rp_width / 2 yp = yp - rp_height / 2 #print xp, yp karamba.moveImage(widget, rechtePupille, xp, yp) karamba.redrawWidget(widget)
def setText(self, text): karamba.changeText(Applet.widget, self.refSplashText, text) for i in range(100): karamba.redrawWidget(Applet.widget)
def hide(self): karamba.deleteText(Applet.widget, self.refSplashText) karamba.deleteImage(Applet.widget, self.refSplash) for i in range(100): karamba.redrawWidget(Applet.widget)
def widgetUpdated(widget): global init global linkePupille global rechtePupille global w_width global w_height global w_x global w_y global lx global ly global la global lb global lp_width global lp_height global rx global ry global ra global rb global rp_width global rp_height global x_old global y_old if init == 0: theme_path = karamba.getThemePath(widget) + "/" # read widget coordinates from eyes.theme # f = open(theme_path + "eyes.theme") # karamba_line = "" #while re.compile('KARAMBA').search(karamba_line) == None: # karamba_line = f.readline() #w_x = int(re.compile('X=([0-9]+)').search(karamba_line).group(1)) #w_y = int(re.compile('Y=([0-9]+)').search(karamba_line).group(1)) #f.close() #karamba.createWidgetMask(widget, theme_path + "pics/mask.png") linkePupille = karamba.createImage(widget, 15, 30, theme_path + "pics/pupille.png") rechtePupille = karamba.createImage(widget, 100, 30, theme_path + "pics/pupille.png") init = 1 karamba.redrawWidget(widget) # query mouse-cursor position x, y = xcursor.position() #fp = os.popen("./xpos") #output = fp.read() #x, y = output.split() #print x, y if x != x_old or y != y_old: x_old, y_old = x, y # Get Widget Position w_x, w_y = karamba.getWidgetPosition(widget) # Calc left pupille xp, yp = pupille (int(x), int(y), lx, ly, la, lb, w_x, w_y) xp = xp - lp_width / 2 yp = yp - lp_height / 2 #print xp, yp karamba.moveImage(widget, linkePupille, xp, yp) # Calc right pupille xp, yp = pupille (int(x), int(y), rx, ry, ra, rb, w_x, w_y) xp = xp - rp_width / 2 yp = yp - rp_height / 2 #print xp, yp karamba.moveImage(widget, rechtePupille, xp, yp) karamba.redrawWidget(widget)
def initWidget(widget): karamba.redrawWidget(widget)