![]() |
[XML] Unbekanntes Prob mit einem gDesklet
Da mein Swap flöten gegangen ist (mich hat die graphische Partion verwirrt bei der Dapper installation ^^), habe ich ein Desklet (FTB-mem-plot) nach meinenn Bedürfnissen angepasst.
D.h. ich habe dsa Label und Plotter weggenommen, die mit dem Swap zu tun haben. Dann dachte ich mir, da ja Linux den RAM als Cache benutzt, einen 2. Plotter einzubauen, der mit den Cachestand anzeigt. Dazu habe ich dann nochmal die Labels umstruktiriert, so dass der Code jetzt so aussieht: (Die veränderten/hinzugefügten Zeilen habe ich mit einem #### markiert!)
XML-Code:
Der Fehler tritt in Zeile 91 auf:
<?xml version="1.0" encoding="UTF-8"?>
<display window-flags="sticky, below"> <meta author="xZise (addapted from Kevin Kane)" version="0.30" name="FTB-mem-plot" category="System/Memory" description="A memory monitor." preview=""/> <control id="sys" interface="ISystem:4i4p0jtvdz87qx44x2dm97ltj"/> <frame id="all" border-width="8,8,15,20" border-uris="gfx/black/w.png,gfx/black/n.png,gfx/black/e.png,gfx/black/s.png, gfx/black/nw.png,gfx/black/ne.png,gfx/black/se.png, gfx/black/sw.png"> <group id="main" width="100" height="100"> <image id="icon" uri="gfx/memory.png" scale="1.0" anchor="center" x="50%" y="50%" on-click="launch(launcher)"/> <image id="face" uri="gfx/black/base.png" image-width="100%" image-height="100%" height="100%" width="100%"/> <plotter id="mem" x="50%" y="95%" anchor="s" color="red" height="90%" width="99%"/> #### <plotter id="cached" x="50%" y="95%" anchor="s" color="blue" height="90%" width="99%"/> <label id="title" value="TEST" x="2%" y="0%" anchor="nw" color="#FFFFFF" font="Sans bold 9"/> <label id="load" value="TEST" x="1%" relative-to="title,x" y="3%" anchor="nw" color="#FFFFFF" font="Sans 8"/> <label id="user_mem" value="TEST" x="0%" relative-to="title,y" y="0%" anchor="nw" color="#FFFFFF" font="Sans 7" wrap-at="95%"/> #### <label id="cached_mem" value="TEST" x="0%" relative-to="title,y" y="15%" anchor="nw" color="#FFFFFF" font="Sans 7" wrap-at="95%"/> #### <label id="total_mem" value="TEST" x="0%" relative-to="title,y" y="30%" anchor="nw" color="#FFFFFF" font="Sans 7" wrap-at="95%"/> </group> </frame> <prefs callback="prefs_cb"> <page label="Appearance"> <title label="Theme:"/> <enum label="Color:" bind="color" help="The color to use."> <item label="Black" value="black/"/> <item label="White" value="white/"/> </enum> <title label="Borders:"/> <boolean label="Top:" bind="top"/> <boolean label="Bottom:" bind="bottom"/> <boolean label="Left:" bind="left"/> <boolean label="Right:" bind="right"/> </page> <page label="Icon / Launcher"> <uri label="Icon Image:" bind="icon_uri"/> <float label="Icon Scale:" min="0.0" max="2.0" digits="2" bind="Dsp.icon.scale"/> <integer label="Horizontal Offset:" min="0" max="100" bind="xoff"/> <integer label="Vertical Offset:" min="0" max="100" bind="yoff"/> <boolean label="Visible:" bind="Dsp.icon.visible"/> <string label="Command:" bind="launcher" /> </page> <page label="Colors"> <font label="Title:" bind="Dsp.title.font"/> <color label="Title:" bind="Dsp.title.color"/> <font label="Load:" bind="Dsp.load.font"/> <color label="Load:" bind="Dsp.load.color"/> <font label="CPU Info:" bind="Dsp.user_mem.font"/> <color label="CPU Info:" bind="Dsp.user_mem.color"/> </page> <page label="Dimensions"> <integer label="Desklet Width:" min="10" max="600" bind="width"/> <integer label="Desklet Height:" min="10" max="600" bind="height"/> </page> <page label="Plotter"> <integer label="Refreshrate (ms):" min="250" max="1000" bind="update"/> <color label="Usermemory Color:" bind="ucol"/> #### <color label="Cachedmemory Color:" bind="ccol"/> </page> </prefs> <script> width = 150 height = 55 </script> <script uri="FTB.script"/> <script> #<![CDATA[ #(left, top, right, bottom) icon_uri = "gfx/memory.png" update = 500 # update interval in ms title = "MEM: " # title displayed on desklet launcher = "xterm" def prefs_cb(key, value): if (key == "width"): set_width(value) if (key == "height"): set_height(value) if (key == "color"): set_face() if (key == "top"): set_top(value) if (key == "bottom"): set_bottom(value) if (key == "left"): set_left(value) if (key == "right"): set_right(value) if (key == "icon_uri"): set_icon(value) if (key == "xoff"): set_icon_x(value) if (key == "yoff"): set_icon_y(value) if (key == "ucol"): set_u_color(value) #### if (key == "ccol"): set_c_color(value) def set_u_color(clr) Dsp.mem.color = clr Dsp.user_mem.color = clr[:7] def set_c_color(clr) Dsp.cached.color = clr Dsp.cached_mem.color = clr[:7] def get_data(): # Plotter m = float(sys.memory.user) / float(sys.memory.total) * 100 Dsp.mem.value = int(m) #### Dsp.cached.value = int(float(sys.memory.cached) / float(sys.memory.total) * 100) Dsp.load.value = "%d%s" % (m, "%") # Data Dsp.user_mem.value = "User: " + mem_format(sys.memory.user) #### Dsp.cached_mem.value = "Cached: " + mem_format(sys.memory.cached) #### Dsp.total_mem.value = "Total: " + mem_format(sys.memory.total) # Timer add_timer(int(update), get_data) return 0 # stolen from SysMon def mem_format(value): if value >= (1024**4): return "%.1f TB" % (value/(1024.0**4)) if value >= (1024**3): return "%.1f GB" % (value/(1024.0**3)) if value >= (1024**2): return "%.1f MB" % (value/(1024.0**2)) if value >= 1000: return "%d kB" % (value/1024.0) else : return "%i" % value Dsp.title.value = title set_face() set_icon(icon_uri) get_data() ]]> </script> </display> Zitat:
|
Re: [XML] Unbekanntes Prob mit einem gDesklet
Hat keiner eine Idee?
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:16 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz