예제 #1
0
 def __init__(self, font='-adobe-*-*-*-*-*-60-*-*-*-*-*-*-*'):
     self.osd = pyosd.osd(font)
     self.osd2 = pyosd.osd(font)
     self.osd.set_align(pyosd.ALIGN_CENTER)
     self.osd.set_pos(pyosd.POS_MID)
     self.osd2.set_align(pyosd.ALIGN_LEFT)
     self.osd2.set_pos(pyosd.POS_BOT)
예제 #2
0
 def __init__(self, font='-adobe-*-*-*-*-*-60-*-*-*-*-*-*-*'):
     self.osd = pyosd.osd(font)
     self.osd2 = pyosd.osd(font)
     self.osd.set_align(pyosd.ALIGN_CENTER)
     self.osd.set_pos(pyosd.POS_MID)
     self.osd2.set_align(pyosd.ALIGN_LEFT)
     self.osd2.set_pos(pyosd.POS_BOT)
예제 #3
0
 def __init__(self,state):
     import pyosd
     if state == "pre" :
         osdfont = "-*-helvetica-medium-r-normal-*-*-200-*-*-p-*-iso8859-1"
         self.pyosd=pyosd.osd(font=osdfont, colour="green", timeout=3, pos=1, offset=100, hoffset=0, shadow=1, align=1, lines=2, noLocale=False)
         self.pyosd.wait_until_no_display()
     elif state == "live" :
         osdfont = "-*-helvetica-medium-r-normal-*-*-230-*-*-p-*-iso8859-1"
         self.pyosd=pyosd.osd(font=osdfont, colour="maroon", timeout=3, pos=1, offset=50, hoffset=0, shadow=1, align=1, lines=2, noLocale=False)
         self.pyosd.wait_until_no_display()
예제 #4
0
def os_display(msg, timeout=100, wait_for_enter=True):
    """Display a simple onscreen message, e.g., to signal completion of a long running task
    
    :param msg: The message to be diplayed
    :type msg: string
    :param timeout: How long to show the message. If wait_for_enter, this setting is ignored.
    :type timeout: int
    :param wait_for_enter: Show message until <Enter> is has been pressed. 
    :type wait_for_enter: bool
    """
    if pyosd != None:
        opt = {
            "font":  #"-*-fixed-*-*-*-*-150-*-*-*-c-90-*-*",
            "-adobe-helvetica-bold-r-normal-*-*-320-*-*-p-*-*",
            "colour": "#FF0000",
            "shadow": 2,
            "offset": 300,
            "pos": pyosd.POS_TOP,
            "timeout": timeout
        }
        osd = pyosd.osd(font=opt["font"],
                        colour=opt["colour"],
                        timeout=opt["timeout"],
                        shadow=opt["shadow"],
                        offset=opt["offset"],
                        pos=opt["pos"])
        #osd = pyosd.osd()
        osd.set_horizontal_offset(10)
        osd.display(msg)
        if wait_for_enter:
            raw_input("Press <enter> to go on")
        else:
            osd.wait_until_no_display()
    else:
        print "pyosd is not available, but needed for displaying on-screen messages."
예제 #5
0
def display_osd(options):
    s = wnck.screen_get_default()
    s.force_update()
    windows = s.get_windows()
    osds = []
    ws = s.get_active_workspace()

    windows = sorted(windows, key=operator.methodcaller("get_pid"))
    windows = [window for window in windows if window.is_visible_on_workspace(ws)]

    for i, window in enumerate(windows):
        if window.is_visible_on_workspace(ws):
            osd = pyosd.osd(options.font)
            osd.set_timeout(-1)
            osd.set_colour(options.colour)
            osd.set_outline_offset(1)
            osd.set_outline_colour(options.outline_colour)
            osd.set_shadow_offset(2)
            x, y = window.get_geometry()[:2]
            osd.set_horizontal_offset(x)
            osd.set_vertical_offset(y)
            # XXX explodes if more than 26 windows are visable.
            osd.display(string.lowercase[i])
            osds.append(osd)
    return osds, windows
예제 #6
0
def os_display(msg,timeout=100,wait_for_enter=True):
    """Display a simple onscreen message, e.g., to signal completion of a long running task
    
    :param msg: The message to be diplayed
    :type msg: string
    :param timeout: How long to show the message. If wait_for_enter, this setting is ignored.
    :type timeout: int
    :param wait_for_enter: Show message until <Enter> is has been pressed. 
    :type wait_for_enter: bool
    """
    if pyosd!=None:
        opt = {"font":#"-*-fixed-*-*-*-*-150-*-*-*-c-90-*-*",
                "-adobe-helvetica-bold-r-normal-*-*-320-*-*-p-*-*",
               "colour": "#FF0000",
               "shadow": 2,
               "offset": 300,
               "pos": pyosd.POS_TOP,
               "timeout": timeout}
        osd = pyosd.osd(font=opt["font"] ,colour=opt["colour"],timeout=opt["timeout"],shadow=opt["shadow"],offset=opt["offset"], pos=opt["pos"])
        #osd = pyosd.osd()
        osd.set_horizontal_offset(10)
        osd.display(msg)
        if wait_for_enter:
            raw_input("Press <enter> to go on")
        else:
            osd.wait_until_no_display()
    else:
        print "pyosd is not available, but needed for displaying on-screen messages."
예제 #7
0
def display_osd(options):
    s = wnck.screen_get_default()
    s.force_update()
    windows = s.get_windows()
    osds = []
    ws = s.get_active_workspace()

    windows = sorted(windows, key=operator.methodcaller("get_pid"))
    windows = [window for window in windows if window.is_visible_on_workspace(ws)]

    for i, window in enumerate(windows):
        if window.is_visible_on_workspace(ws):
            osd = pyosd.osd(options.font)
            osd.set_timeout(-1)
            osd.set_colour(options.colour)
            osd.set_outline_offset(1)
            osd.set_outline_colour(options.outline_colour)
            osd.set_shadow_offset(2)
            x, y = window.get_geometry()[:2]
            osd.set_horizontal_offset(x)
            osd.set_vertical_offset(y)
            # XXX explodes if more than 26 windows are visable.
            osd.display(string.lowercase[i])
            osds.append(osd)
    return osds, windows
예제 #8
0
    def __init__(self):
        super(TinyXOSDGraphicsDisplay, self).__init__()

        self.xosd = pyosd.osd()
        self.xosd.set_font(OSD_MESSAGE_FONT)
        self.xosd.set_colour(OSD_MESSAGE_COLOR)
        self.xosd.set_timeout(OSD_MESSAGE_TIMEOUT)
        self.xosd.set_offset(OSD_MESSAGE_OFFSET)
예제 #9
0
    def __init__(self):
        super(TinyXOSDGraphicsDisplay, self).__init__()

        self.xosd = pyosd.osd()
        self.xosd.set_font(OSD_MESSAGE_FONT)
        self.xosd.set_colour(OSD_MESSAGE_COLOR)
        self.xosd.set_timeout(OSD_MESSAGE_TIMEOUT)
        self.xosd.set_offset(OSD_MESSAGE_OFFSET)
예제 #10
0
 def __init__(self):
     bus_name = dbus.service.BusName('test.grimpy.pyosdbus', bus = dbus.SessionBus())
     dbus.service.Object.__init__(self, bus_name, '/test/grimpy/pyosdbus')
     self.osd = pyosd.osd(font='-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*')
     self.osd.set_colour('green')
     self.osd.set_align(pyosd.ALIGN_CENTER)
     self.osd.set_pos(pyosd.POS_MID)
     self.osd.set_timeout(2)
     self.osd.set_shadow_offset(3)
예제 #11
0
 def run(self):    
     import pyosd
     text = "%s\n%s" % (self.name, self.text)
     text_lines = textwrap.fill(text, 40).split(os.linesep)
     osd = pyosd.osd(lines=len(text_lines), shadow=2, colour="#FFFF00")
     line_number = 0
     for text_line in text_lines:
         osd.display(text_line, line=line_number)
         line_number += 1
     time.sleep(3)
예제 #12
0
 def run(self):
     import pyosd
     text = "%s\n%s" % (self.name, self.text)
     text_lines = textwrap.fill(text, 40).split(os.linesep)
     osd = pyosd.osd(lines=len(text_lines), shadow=2, colour="#FFFF00")
     line_number = 0
     for text_line in text_lines:
         osd.display(text_line, line=line_number)
         line_number += 1
     time.sleep(3)
예제 #13
0
    def __initOSD(self):
        print "CALL LyricsOSD __initOSD"

        conf = LyricsConf()

        v_lines = conf.getint("OSD", "lines", 1)
        v_shadow = conf.getint("OSD", "shadow", 1)

        self.__OSD = pyosd.osd(lines=v_lines, shadow=v_shadow)

        if self.__OSD == None:
            self.__OSD = pyosd.osd()

        try:
            self.__OSD.set_font(conf.get("OSD", "font"))
        except:
            self.__OSD.set_font("-*-*-*-*-*-*-*-*-*-*-*-*-*-*")

        try:
            self.__OSD.set_colour(conf.get("OSD", "colour"))
        except:
            print "colour not defined,use default"

        try:
            self.__OSD.set_timeout(conf.getint("OSD", "timeout"))
        except:
            print "timeout not defined,use default"

        try:
            self.__OSD.set_pos(conf.getint("OSD", "pos"))
        except:
            print "pos not defined,use default"

        try:
            self.__OSD.set_align(conf.getint("OSD", "align"))
        except:
            print "align not defined,use default"

        try:
            self.__OSD.set_offset(conf.getint("OSD", "offset"))
        except:
            print "offset not defined,use default"
예제 #14
0
    def __initOSD(self):
        print "CALL LyricsOSD __initOSD"

        conf = LyricsConf()

        v_lines = conf.getint("OSD","lines",1)
        v_shadow = conf.getint("OSD","shadow",1)

        self.__OSD=pyosd.osd(lines=v_lines,shadow=v_shadow)

        if self.__OSD==None:
            self.__OSD = pyosd.osd()

        try:
            self.__OSD.set_font( conf.get("OSD","font") )
        except:
            self.__OSD.set_font("-*-*-*-*-*-*-*-*-*-*-*-*-*-*")

        try:
            self.__OSD.set_colour( conf.get("OSD","colour") )
        except:
            print "colour not defined,use default"

        try:
            self.__OSD.set_timeout( conf.getint("OSD","timeout") )
        except:
            print "timeout not defined,use default"

        try:
            self.__OSD.set_pos( conf.getint("OSD","pos") )
        except:
            print "pos not defined,use default"

        try:
            self.__OSD.set_align( conf.getint("OSD","align") )
        except:
            print "align not defined,use default"

        try:
            self.__OSD.set_offset( conf.getint("OSD","offset") )
        except:
            print "offset not defined,use default"
예제 #15
0
파일: power.py 프로젝트: shladnik/power.py
def osd(text, size=20):
  #http://en.wikipedia.org/wiki/X_logical_font_description
  global p # Without that OSD disappears immediately
  #font="-misc-fixed-medium-r-normal--20-140-100-100-c-100-iso8859-1"
  font="-misc-fixed-medium-r-normal--" + str(int(size)) + "-*-*-*-*-*-*"
  try:
    p = pyosd.osd(font=font, colour='#BBBBBB', timeout=2, pos=2, offset=0, hoffset=0, shadow=int(size*5/8), align=1, lines=1, noLocale=False)
  except:
    print(font)
    raise
  p.display(text)
예제 #16
0
  def __init__( self, disable=0, font= "-*-courier-*-*-*-*-34-*-*-*-*-*-*-*" ):
    if not disable:
      try:
        import pyosd
        self.ok = 1
      except:
        log(LOG_ERR, "Could not import pyosd. Set DISABLE_PYOSD=1")
        return None

      self.p = pyosd.osd( font=font, offset=200, colour="#2222cc" )
      self.p.set_align( pyosd.ALIGN_CENTER )
예제 #17
0
파일: base.py 프로젝트: kratorius/osdwidget
    def __init__(self):
        osd = pyosd.osd(font=FONT_FACE)
        self.msg = ""

        # set common stuff
        osd.set_outline_offset(1)
        osd.set_timeout(0)
        osd.set_vertical_offset(2)
        osd.set_align(pyosd.ALIGN_RIGHT)
        osd.set_pos(pyosd.POS_TOP)
        osd.set_colour("yellow")

        self.osd = osd
예제 #18
0
 def __init__(self):
     self.invert = False
     self.colors = ["gray", "red", "green", "yellow", "blue", "magenta", "cyan", "white"]
     self.defaultcolor = 3
     self.xroot = Xlib.display.Display().screen().root
     # Get horizontal sceen resolution.
     self.hres = self.xroot.get_geometry().width
     # How many characters can fit in a line at this resolution?
     self.maxcpl = int(self.hres / 22.4)
     self.osd = []
     # We can display five simutaneous events at a time.
     for n in xrange(0, 5, 1):
         self.osd.append(pyosd.osd(lines=3))
         self.osd[n].set_font("-*-dejavu sans mono-bold-r-*-*-36" "-*-*-*-*-*-iso10646-1")
         self.osd[n].set_outline_offset(4)
예제 #19
0
파일: clock.py 프로젝트: imclab/obHUD
 def __init__(self, 
              pos    = pyosd.POS_BOT, 
              align  = pyosd.ALIGN_RIGHT, 
              sleep  = 1, 
              style  = "%a %d %b %Y %I:%M:%S %p",
              colour = "red",
              outline_colour = "black",
              font   = default_font, 
              shadow = 0):
     
     self.osd = pyosd.osd(colour = colour, timeout = 0, 
                          pos = pos, lines = self.lines, 
                          font = font, shadow = shadow,
                          align = align)
     self.osd.set_outline_offset(1);
     self.osd.set_outline_colour(outline_colour);
예제 #20
0
파일: conta.py 프로젝트: bhdn/bogdano
def show(op, val1, val2, resp):
    osd = pyosd.osd("-*-helvetica-*-r-*-*-24-*-*-*-*-*-*-*", "green")
    osd.set_pos(pyosd.POS_MID)
    osd.set_align(pyosd.ALIGN_CENTER)
    question = "%d %s %d ???" % (val1, op, val2)
    osd.display(question)
    delay = 5
    if val1 > 15 or val2 > 15:
        if op in "*/":
            delay = 17
        else:
            delay = 9
    time.sleep(delay)
    osd.set_colour("red")
    osd.display("%s => %s!!!" % (question, resp))
    time.sleep(5)
예제 #21
0
def show(op, val1, val2, resp):
    osd = pyosd.osd("-*-helvetica-*-r-*-*-24-*-*-*-*-*-*-*", "green")
    osd.set_pos(pyosd.POS_MID)
    osd.set_align(pyosd.ALIGN_CENTER)
    question = "%d %s %d ???" % (val1, op, val2)
    osd.display(question)
    delay = 5
    if val1 > 15 or val2 > 15:
        if op in "*/":
            delay = 17
        else:
            delay = 9
    time.sleep(delay)
    osd.set_colour("red")
    osd.display("%s => %s!!!" % (question, resp))
    time.sleep(5)
예제 #22
0
    def __init__(self):
        """
        init the osd
        """
        plugin.DaemonPlugin.__init__(self)
        self.plugin_name = 'OSD_MESSAGE'

        # Initializing the screen
        self.osd = pyosd.osd()
        self.osd.set_font(OSD_MESSAGE_FONT)
        self.osd.set_colour(OSD_MESSAGE_COLOR)
        self.osd.set_timeout(OSD_MESSAGE_TIMEOUT)
        self.osd.set_offset(OSD_MESSAGE_OFFSET)

        self.message = ''
        # (0%) -> (100%)
        self.re_percent = re.compile(r' [0-9][0-9]?[0-9]?%')
예제 #23
0
    def __init__(self):
        """
        init the osd
        """
        plugin.DaemonPlugin.__init__(self)
        self.plugin_name = 'OSD_MESSAGE'

        # Initializing the screen
        self.osd = pyosd.osd()
        self.osd.set_font(OSD_MESSAGE_FONT)
        self.osd.set_colour(OSD_MESSAGE_COLOR)
        self.osd.set_timeout(OSD_MESSAGE_TIMEOUT)
        self.osd.set_offset(OSD_MESSAGE_OFFSET)

        self.message = ''
        # (0%) -> (100%)
        self.re_percent = re.compile(r' [0-9][0-9]?[0-9]?%')
예제 #24
0
def main():
    import optparse
    parser = optparse.OptionParser(__doc__.strip())
    opts, args = parser.parse_args()

    global osd
    osd = pyosd.osd(font, color,
                    timeout=-1,
                    pos=pyosd.POS_BOT,
                    lines=1, # leave space for minibuffer
                    shadow=2,
                    )

    hm = get_hook_manager()

    # Allow interrupts.
    import signal; signal.signal(signal.SIGINT, signal.SIG_DFL)
예제 #25
0
 def __init__(self, 
              pos    = pyosd.POS_TOP, 
              align  = pyosd.ALIGN_LEFT, 
              sleep  = 1, 
              style  = "%a %d %b %Y %I:%M:%S %p",
              colour = "white",
              outline_colour = "black",
              font   = default_font, 
              shadow = 0):
     
     self.osd = pyosd.osd(colour = colour, timeout = 0, 
                          pos = pos, lines = self.lines, 
                          font = font, shadow = shadow,
                          align = align)
     self.osd.set_outline_offset(1)
     self.osd.set_vertical_offset(200)
     self.osd.set_outline_colour(outline_colour)
예제 #26
0
 def __init__(self):
     self.invert = False
     self.colors = [
         'gray', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan',
         'white'
     ]
     self.defaultcolor = 3
     self.xroot = Xlib.display.Display().screen().root
     # Get horizontal sceen resolution.
     self.hres = self.xroot.get_geometry().width
     # How many characters can fit in a line at this resolution?
     self.maxcpl = int(self.hres / 22.4)
     self.osd = []
     # We can display five simutaneous events at a time.
     for n in xrange(0, 5, 1):
         self.osd.append(pyosd.osd(lines=3))
         self.osd[n].set_font('-*-dejavu sans mono-bold-r-*-*-36' \
                              '-*-*-*-*-*-iso10646-1')
         self.osd[n].set_outline_offset(4)
예제 #27
0
    def __init__(self, mouse, smooth_aggressiveness=8, smooth_falloff=1.3):
        super(Finger_Control_Listener, self).__init__()  #Initialize like a normal listener

        self.click_finger  = Leap.Finger.TYPE_INDEX
        self.rclick_finger = Leap.Finger.TYPE_THUMB

        self.blank_frame = True
        self.was_grabbing = False
        self.cursor = mouse.relative_cursor()

        self.track_hand     = 1
        self.track_finger   = Leap.Finger.TYPE_MIDDLE
        self.click_fingers  = [Leap.Finger.TYPE_INDEX,
                               Leap.Finger.TYPE_RING]
        self.rclick_fingers = [Leap.Finger.TYPE_THUMB]

        self.base_scale      = 10.0
        self.scale_fac       = 20.0
        self.distance_cutoff = 0.15
        self.min_confidence  = 0.0

        self.do_grab         = False
        self.grab_cutoff     = 0.85

        self.tracking        = True
        self.track_change    = 0
        self.track_min_delta = 1.0

        self.circling        = False
        self.circle_finger   = Leap.Finger.TYPE_INDEX
        self.circle_radius   = 1.0
        self.circle_duration = 0.0
 
        self.scroll_last     = 0.0
        self.scroll_delay    = 0.2

        self.tap_finger      = Leap.Finger.TYPE_PINKY

        self.osd             = pyosd.osd()
        self.osd.set_colour("#FF0000")
예제 #28
0
 def __init__( self, host = 'localhost', port = 80 ):
     super(BitterPinger, self).__init__()
     self.host           = host
     self.port           = port
     self.currently_up   = False
     self.previously_up  = False
     self.up_interval    = 60
     self.down_interval  = 30
     self.seconds        = self.down_interval
     self.connectTimeout = self.down_interval - 1
     self.osd            = pyosd.osd(
         font='-*-helvetica-*-r-*-*-*-*-*-*-*-182-*-*',
         colour = "firebrick",
         timeout = self.seconds - 1,
         pos = pyosd.POS_TOP,
         align = pyosd.ALIGN_CENTER,
         offset = 0,
         hoffset = 0,
         shadow = 2,
         lines = 2
     )
     return
예제 #29
0
#!/usr/bin/env python2
#display time using osd

import sys

from datetime import datetime

import pyosd

osd = pyosd.osd(font='-*-*-medium-r-normal-*-*-360-*-*-p-*-*-*')
osd.set_timeout(4)
if '-t' in sys.argv:
    text = sys.argv[-1]
else:
    text = datetime.now().strftime('%H:%M')
osd.set_align(pyosd.ALIGN_CENTER)
osd.set_pos(pyosd.POS_MID)
osd.set_outline_offset(2)
osd.set_outline_colour('black')
osd.display(text)
osd.wait_until_no_display()
예제 #30
0
def by_pyosd(message):
    import pyosd
    p = pyosd.osd("-misc-fixed-medium-r-normal--20-200-75-75-c-100-iso8859-1", colour="green", pos=pyosd.POS_BOT,offset=40, align=pyosd.ALIGN_CENTER)
    p.display(message)
예제 #31
0
파일: daemon.py 프로젝트: dzen/pyosd
PYOSD_DIR = os.path.expanduser("~/.pyosd")
PYOSD_SOCKET = os.path.join(PYOSD_DIR, "socket")
MODULES_DIR = os.path.join(PYOSD_DIR, "modules")

if __name__ == "__main__":

    if len(sys.argv)>1 and sys.argv[1] == "allinterfaces":
        allinterfaces=1
    else:
        allinterfaces=0

    args = []
    kwargs = {'shadow': 0}

    pyosd.daemon.top = pyosd.osd(*args, **kwargs)
    pyosd.daemon.top.set_pos(pyosd.POS_TOP)
    pyosd.daemon.bot = pyosd.osd(*args, **kwargs)
    pyosd.daemon.bot.set_pos(pyosd.POS_BOT)

    pyosd.daemon.top.set_outline_offset(1)
    pyosd.daemon.bot.set_outline_offset(1)

    class PyOSDServ:
        modules = {}
        error = 0
        files = os.listdir(MODULES_DIR)
        for f in files:
            try:
                namespace = {}
                exec(compile(open(os.path.join(MODULES_DIR, f)).read(), os.path.join(MODULES_DIR, f), 'exec'), namespace)
예제 #32
0
import dbus.decorators
import dbus.glib
import gobject
from time import sleep
"""
init
"""

# init pyosd
font = "-*-helvetica-*-r-normal--30-*-*-*-*-*-*-*"

import locale

locale.setlocale(locale.LC_ALL, "")

p = pyosd.osd(font, colour="#4040ff", shadow=2)
p.set_shadow_offset(2)
p.set_vertical_offset(200)
p.set_bar_length(20)
p.set_align(pyosd.ALIGN_CENTER)
p.set_timeout(2)

# init hotkey input device object
udi = '/org/freedesktop/Hal/devices/computer_logicaldev_input'
bus = dbus.SystemBus()
obj = bus.get_object('org.freedesktop.Hal', udi)
"""
volume
"""

예제 #33
0
#!/usr/bin/env python
import mpd 					                        # Import MPD Library
import pyosd										            # Import OSD Library
import time											            # Import Internal Time Module

client = mpd.MPDClient()							      # Init MPD Client
client.connect("localhost", 6600)					  # Connect to local MPD Server

cs = client.currentsong()                   # Get the currentsong dict
if 'title' in cs:                           # Check to see if "title" title exists in the dict
 	songtitle = cs['title']                   # If it does set songtitle to the id3 title
elif 'file' in cs:                          # If it doesn't have a title use the filename
 	songtitle = cs['file']                    # Set songtitle to the filename

songartist = " by "
songartist += cs['artist']                  # Set songartist if the song has one

FONT = "-*-helvetica-*-r-normal--34-*-*"    # Set the font (a big bold one that's clearly visible)

COLOR = "#287D28"									        # Set the color (Dark Gren)
p = pyosd.osd(font=FONT, colour=COLOR)		  # init pyosd with the font and color
p.display(songtitle  + songartist)          # Finally use Pyosd to display the song title

time.sleep(2)                               # Show the message for 2 seconsd
예제 #34
0
파일: asublim.py 프로젝트: PVS-s/asublim
    time.sleep(ms * 0.0001)


def set_pos(x, y):
    osd.set_horizontal_offset(x)
    osd.set_vertical_offset(y)


def displayWord(word):
    set_pos(random.randint(0, width), random.randint(0, height))
    osd.display(word)
    osd.show()
    usleep(random.randint(delayShowMin, delayShowMax))
    osd.hide()
    usleep(random.randint(delayWordMin, delayWordMax))


osd = pyosd.osd(font, color)
osd.set_outline_colour("black")
osd.set_timeout(timeout)


def main():
    for line in inputStream.xreadlines():
        for word in line.replace("\0", " ").split():
            displayWord(word)


main()
osd.wait_until_no_display()
예제 #35
0
파일: bat.py 프로젝트: ilardm/battery
argc=len(argv)

# tts=1800 # time to suspend (seconds)
pts = 7 # percents to suspend
percents=100

isLinux=( sys.platform.find("linux")>=0 )
isObsd=( sys.platform.find("openbsd")>=0 )

# workaround 4 pyosd
if (not os.environ.has_key("DISPLAY")):
	os.putenv("DISPLAY", ":0.0")

notifyer = None
if not NO_PYOSD:
    notifyer=pyosd.osd(colour="#00FF00", shadow=3, timeout=3, pos=pyosd.POS_BOT, font='-*-*-*-*-*-*-20-*-*-*-*-*-koi8-r')
    notifyer.set_shadow_offset(2)
    notifyer.set_shadow_colour("#000000")

# functions
def dump(remTime):
    fh=open(batPath_prev, "w")
    fh.write( str( int(time.time()) )+"\n" )
    fh.write( str( remCap )+"\n" )
    fh.write( str( remTime )+"\n" )
    fh.close()

    # chmod only if own this file
    if ( os.getuid() == os.stat( batPath_prev )[5] ):
        os.chmod( batPath_prev, stat.S_IRUSR | stat.S_IWUSR |
                                stat.S_IRGRP | stat.S_IWGRP |
예제 #36
0
 def __init__(self, timeout, font, color):
     self.osd = pyosd.osd(font=font, colour=color)
     self.timeout = timeout
예제 #37
0
def start_pyosd():
  import pyosd
  font = "-*-helvetica-medium-r-normal-*-*-250-*-*-p-*-*-*"
  OSD['p'] = pyosd.osd( font=font, offset=200, colour="#2222cc" )
  OSD['p'].set_align( pyosd.ALIGN_CENTER )
예제 #38
0
For details on the Pomodoro technique, please refer http://www.pomodorotechnique.com/
For the sound files, please check out http://www.soundjay.com/clock-sounds-1.html

This script is an attempt to create an offline version of http://www.focusboosterapp.com/live.cfm

"""

import sys
import time
import subprocess

pyosd = False
try:
    import pyosd
    osd = pyosd.osd()
    osd.set_align(pyosd.ALIGN_CENTER)
    osd.set_pos(pyosd.POS_MID)
    display = osd.display
except:
    display = lambda x: sys.stdout.write(str(x) + "\n")

WORK_TICK = "/home/noufal/scratch/clock-ticking-4.mp3"
REST_TICK = "/home/noufal/scratch/clock-ticking-5.mp3"
ALARM = "/home/noufal/scratch/alarm-clock-1.mp3"
DEV_NULL = open("/dev/null", "w")


def tick(duration, tick):
    "Plays a the ticking sound specified by tick for duration time"
    cmd = ["mpg123", "--loop", "-1", tick]
예제 #39
0
 def __init__(self, timeout, font, color):
     self.osd = pyosd.osd(font=font, colour=color)
     self.timeout = timeout
예제 #40
0
import dbus.decorators
import dbus.glib
import gobject
from time import sleep

"""
init
"""

# init pyosd
font = "-*-helvetica-*-r-normal--30-*-*-*-*-*-*-*"

import locale
locale.setlocale(locale.LC_ALL, "")

p = pyosd.osd(font, colour="#4040ff", shadow=2)
p.set_shadow_offset(2)
p.set_vertical_offset(200)
p.set_bar_length(20)
p.set_align(pyosd.ALIGN_CENTER)
p.set_timeout(2)

# init hotkey input device object
udi='/org/freedesktop/Hal/devices/computer_logicaldev_input'
bus = dbus.SystemBus()
obj = bus.get_object( 'org.freedesktop.Hal', udi)

"""
volume
"""
예제 #41
0
#!/usr/bin/python

import time
import pyosd

# Check https://github.com/dmitrodem/libxosd
# https://github.com/sharad/libxosd/blob/master/src/libxosd/xosd.c
# https://github.com/sharad/libxosd/blob/master/src/osd_cat.c

# p = pyosd.osd()
# p = pyosd.osd(font = 'fixed')
# p = pyosd.osd(font = "DejaVu Sans Mono:style=Book")
p = pyosd.osd(
    font="-Misc-Fixed-Medium-R-SemiCondensed--13-120-75-75-C-60-ISO8859-1",
    lines=12)

p.display("eschew obfuscation")
# p.set_pos(pyosd.POS_BOT)
p.set_pos(pyosd.ALIGN_RIGHT)
p.set_pos(pyosd.POS_MID)
p.set_timeout(30)

for i in range(0, 11, 4):
    # p.set_line(100)
    p.display("this will be down the bottom.", 0, i)
    p.display("Hello this will be down the bottom.", 0, i + 1)
    # https://askubuntu.com/questions/769218/pyosd-works-with-interpreter-but-not-with-a-script
    p.show()
    # p.wait_until_no_display()
    time.sleep(1)
    p.display("THIS WILL BE DOWN THE BOTTOM.", 0, i + 2)
예제 #42
0
For details on the Pomodoro technique, please refer http://www.pomodorotechnique.com/
For the sound files, please check out http://www.soundjay.com/clock-sounds-1.html

This script is an attempt to create an offline version of http://www.focusboosterapp.com/live.cfm

"""

import sys
import time
import subprocess

pyosd = False
try:
    import pyosd
    osd = pyosd.osd()
    osd.set_align(pyosd.ALIGN_CENTER)
    osd.set_pos(pyosd.POS_MID)
    display = osd.display
except:
    display = lambda x: sys.stdout.write(str(x)+"\n")
    
WORK_TICK = "/home/noufal/scratch/clock-ticking-4.mp3"
REST_TICK = "/home/noufal/scratch/clock-ticking-5.mp3"
ALARM     = "/home/noufal/scratch/alarm-clock-1.mp3"
DEV_NULL  = open("/dev/null","w")

def tick(duration, tick):
    "Plays a the ticking sound specified by tick for duration time"
    cmd = ["mpg123", "--loop", "-1" , tick]
    p = subprocess.Popen(cmd, stdout = DEV_NULL, stderr = subprocess.PIPE)
예제 #43
0
 def __init__(self, data, conf):
     """ """
     self.data = data
     self.conf = conf
     self.p = pyosd.osd()
예제 #44
0
 def __init__(self, data, conf):
     """ """
     self.data = data
     self.conf = conf
     self.p = pyosd.osd()
예제 #45
0
# based on pyosd.py plugin

# global var
is_osd = False

# menu item
menu_item = gtk.MenuItem(_("PyOSD: " + str(is_osd)))  #
menu = gtk.Menu()

# default_font="-*-helvetica-medium-r-normal-*-*-360-*-*-p-*-*-*"
# xlsfonts | less # to find fonts, say
# -misc-fixed-bold-r-normal--0-0-75-75-c-0-iso10646-1:
#~ tfont="-*-fixed-bold-r-normal--*-*-100-*-c-*-*-*"
tfont = "-*-fixed-bold-r-normal--*-*-150-150-c-*-*-*"
osd = pyosd.osd(font=tfont, colour='#FF0000', lines=3)  #1) #3)
#~ osd.set_align(pyosd.ALIGN_CENTER)
osd.set_align(pyosd.ALIGN_LEFT)
osd.set_pos(pyosd.POS_MID)
display = osd.display
osd.set_timeout(1)
# display will last as long the python program hasn't exited!
#display("Hello")
#display(50, type=pyosd.TYPE_SLIDER, line=0)

display("Hello from glipper pyosd/XOSD", line=1)  #0) #1)


def printarr(inarr):
    print("\n")
    ic = 0