summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system/xmsg.py
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2012-08-22 14:53:41 (GMT)
committerJames Meyer <james.meyer@operamail.com>2012-08-22 14:53:41 (GMT)
commitee9f3a54c5fe17cf481051d9c951a242200ead02 (patch)
treec455bdca501adcb04dc7609de1d6529cce4c2c57 /abs/core/LinHES-system/xmsg.py
parent7e990c0f0b1bc3ba66efb23789cd46744feba37f (diff)
downloadlinhes_pkgbuild-ee9f3a54c5fe17cf481051d9c951a242200ead02.zip
linhes_pkgbuild-ee9f3a54c5fe17cf481051d9c951a242200ead02.tar.gz
linhes_pkgbuild-ee9f3a54c5fe17cf481051d9c951a242200ead02.tar.bz2
LinHES-system: cleanup of the osd system.
rename xmsg.py to msg_osd.py change diskspace.sh to use msg_client.py
Diffstat (limited to 'abs/core/LinHES-system/xmsg.py')
-rw-r--r--abs/core/LinHES-system/xmsg.py163
1 files changed, 0 insertions, 163 deletions
diff --git a/abs/core/LinHES-system/xmsg.py b/abs/core/LinHES-system/xmsg.py
deleted file mode 100644
index 669a796..0000000
--- a/abs/core/LinHES-system/xmsg.py
+++ /dev/null
@@ -1,163 +0,0 @@
-#!/usr/bin/python2
-# other modules
-
-import sys, string
-import aosd
-import ConfigParser
-import getopt
-
-
-# =================================
-
-
-class msg():
- def scroll(self,osd, width, height, display_time,position):
- pos = position
- step = 1
-
- osd.set_position(pos, width, height)
- (x, y, _, _) = osd.get_geometry()
- osd.set_position_offset(width, height)
- osd.show()
-
- x -= 1
- y += height - 1;
- for i in range(1, height + 1, step):
- osd.loop_for(5)
- y -= step
- osd.set_geometry(x, y, width, i)
-
- osd.set_position(pos, width, height)
- osd.set_position_offset(-1, -1)
- (x, y, _, _) = osd.get_geometry()
- #time to display
- osd.loop_for(display_time)
-
- for i in range(height, 0, -step):
- y += step
- osd.set_geometry(x, y, width, i);
- osd.loop_for(1);
-
- osd.hide();
-
- def setup(self,font_color,font_type):
- osd = aosd.AosdText()
- osd.set_transparency(aosd.TRANSPARENCY_COMPOSITE)
- if osd.get_transparency() != aosd.TRANSPARENCY_COMPOSITE:
- osd.set_transparency(aosd.TRANSPARENCY_NONE)
-
- osd.geom_x_offset = 10
- osd.geom_y_offset = 0
-
- osd.back_color = "white"
- osd.back_opacity = 50
-
- osd.shadow_color = "black"
- osd.shadow_opacity = 127
- osd.shadow_x_offset = 2
- osd.shadow_y_offset = 2
-
- osd.fore_color = font_color
- osd.fore_opacity = 255
-
- osd.set_font(font_type)
- osd.wrap = aosd.PANGO_WRAP_WORD_CHAR
- osd.alignment = aosd.PANGO_ALIGN_LEFT
- osd.set_layout_width(osd.get_screen_wrap_width())
- return osd
-
- def set_string(self, osd, text):
- osd.set_text(text)
- return osd.get_text_size()
-
- def setup_config(self):
- module_config = ConfigParser.RawConfigParser()
- try:
- module_config.read('/usr/MythVantage/etc/msg.cfg')
- except:
- pass
- return module_config
-
-
-
- def display (self,flags):
- """
- parse the msg for display.
- """
- try:
- text,config_section=flags.split("|")
- if config_section == '':
- config_section="default"
- except:
- text=flags
- config_section="default"
-
- module_config = self.setup_config()
-
- display_time=5000
- position=6
- font_color="green"
- font_type="Times New Roman Italic 36"
- try:
- display_time = int(module_config.get(config_section,"display_time"))
- except:
- pass
- try:
- position = int(module_config.get(config_section,"position"))
- except:
- pass
- try:
- font_color = module_config.get(config_section,"font_color")
- except:
- pass
- try:
- font_type = module_config.get(config_section,"font_type")
- except:
- pass
-
- #this bit of code converts a \n to EOL/BREAK
- textline=text.split('\\n')
- try:
- textline.remove(' ')
- except:
- pass
- text=chr(10).join(textline)
-
- #cmd = sub_process.Popen("/usr/bin/wall %s" % text,stdout=sub_process.PIPE,shell=True)
- #data = cmd.communicate()[0]
- osd = self.setup(font_color, font_type)
- width, height = self.set_string(osd, text)
- self.scroll(osd, width, height, display_time, position)
-
- return ("Message delivered")
-
-
-
-
-def main():
- try:
- opts, args = getopt.getopt(sys.argv[1:], "hm:", ["help", "msg="])
- except getopt.GetoptError, err:
- # print help information and exit:
- print str(err) # will print something like "option -a not recognized"
- usage()
- sys.exit(2)
- in_msg = None
-
- for o, a in opts:
- if o in ("-h", "--help"):
- usage()
- sys.exit()
- elif o in ("-m", "--msg"):
- in_msg = a
- else:
- assert False, "unhandled option"
- txt_msg=in_msg
- out_msg=msg()
-
- out_msg.display(txt_msg)
-
-if __name__ == "__main__":
- main()
-
-