예제 #1
0
파일: unicode.py 프로젝트: Fat-Zer/tdeutils
def initWidget(widget):

    text=u"""
<h1>UNICODE Example</h1>
<h3>Greek:</h3>
\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF\u03C0
\u03C1\u03C2\u03C3\u03C4\u03C5\u03C6\u03C7\u03C8\u03C9
<br>
\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039A\u039B\u039C\u039D\u039E\u039F\u03A0
\u03A1\u03A3\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9
<h3>Cyrillic:</h3>
\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F
\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F
<br>
\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F
\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F
<h3>Hebrew:</h3>
\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF
\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7\u05E8\u05E9\u05EA
<h3>Arabic:</h3>
\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630
\u0631\u0632\u0633\u0634\u0635\u0636\u0637\u0638\u0639\u063A\u0641\u0642\u0643\u0644\u0645\u0646
\u0647\u0648\u064A
<p>
For a complete reference on unicode caracter codes look at:
<center><a href="kfmclient openURL http://www.unicode.org/charts/">www.unicode.org/charts/</a></center>
</p>
"""
    karamba.resizeWidget(widget, 400, 400)

    richtext = karamba.createRichText(widget, text)

    karamba.setRichTextWidth(widget, richtext, 370)
예제 #2
0
def initWidget(widget):

    text = u"""
<h1>UNICODE Example</h1>
<h3>Greek:</h3>
\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF\u03C0
\u03C1\u03C2\u03C3\u03C4\u03C5\u03C6\u03C7\u03C8\u03C9
<br>
\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039A\u039B\u039C\u039D\u039E\u039F\u03A0
\u03A1\u03A3\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9
<h3>Cyrillic:</h3>
\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F
\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F
<br>
\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F
\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F
<h3>Hebrew:</h3>
\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF
\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7\u05E8\u05E9\u05EA
<h3>Arabic:</h3>
\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F\u0630
\u0631\u0632\u0633\u0634\u0635\u0636\u0637\u0638\u0639\u063A\u0641\u0642\u0643\u0644\u0645\u0646
\u0647\u0648\u064A
<p>
For a complete reference on unicode caracter codes look at:
<center><a href="kfmclient openURL http://www.unicode.org/charts/">www.unicode.org/charts/</a></center>
</p>
"""
    karamba.resizeWidget(widget, 400, 400)

    richtext = karamba.createRichText(widget, text)

    karamba.setRichTextWidth(widget, richtext, 370)
예제 #3
0
    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)
예제 #4
0
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)
예제 #5
0
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)
예제 #6
0
파일: Applet.py 프로젝트: gilcn/nextshows
    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)
예제 #7
0
    global theme_dir, Instances
    id = karamba.readConfigEntry(widget, "id")

    #### Begin reading the [top] section of the config file ####
    num_procs = karamba.readConfigEntry(widget, "num_procs")
    if num_procs == None or int(num_procs) < 1:
        try:
            num_procs = theme_cfg.getint("top", "num_procs")
            Instances[id].setNumProcs(num_procs)
        except ConfigParser.NoOptionError, (strerror):
            print "Warning: " + str(strerror) + ". Using default."

    # The size of the widget. Required.
    try:
        w, h = theme_cfg.get("karamba", "themesize").split(",", 1)
        karamba.resizeWidget(widget, int(w), int(h))
    except ConfigParser.NoOptionError, (strerror):
        displayError(
            'Theme Size',
            'Missing parameters for the width and height of the theme.')
        raise


def readConfigImages(widget, theme_cfg):
    #### Begin reading [background images] and [images] from the config file ####
    for image in theme_cfg.options("background images"):
        x, y, file = theme_cfg.get("background images", image).split(",", 2)
        karamba.createBackgroundImage(widget, int(x), int(y), file.strip())

    for image in theme_cfg.options("images"):
        x, y, file = theme_cfg.get("images", image).split(",", 2)
예제 #8
0
	global theme_dir, Instances
	id = karamba.readConfigEntry(widget, "id")

	#### Begin reading the [top] section of the config file ####
	num_procs = karamba.readConfigEntry(widget, "num_procs")
	if num_procs == None or int(num_procs) < 1:
		try:
			num_procs = theme_cfg.getint( "top", "num_procs" )
			Instances[id].setNumProcs(num_procs)
		except ConfigParser.NoOptionError, (strerror):
			print "Warning: " + str(strerror) + ". Using default."

	# The size of the widget. Required.
	try:
		w, h = theme_cfg.get( "karamba", "themesize" ).split(",", 1 )
		karamba.resizeWidget( widget, int(w), int(h) )
	except ConfigParser.NoOptionError, (strerror):
		displayError('Theme Size', 'Missing parameters for the width and height of the theme.')
		raise


def readConfigImages(widget, theme_cfg):
	#### Begin reading [background images] and [images] from the config file ####
	for image in theme_cfg.options("background images"):
		x, y, file = theme_cfg.get( "background images", image ).split(",", 2)
		karamba.createBackgroundImage(widget, int(x), int(y), file.strip())

	for image in theme_cfg.options("images"):
		x, y, file = theme_cfg.get( "images", image ).split(",", 2)
		karamba.createImage(widget, int(x), int(y), file.strip())