Пример #1
0
def main():

    main.web = webkit.WebView()
    win = gtk.Window()
    #win.fullscreen()
    win.set_default_size(800,800)
    scroller = gtk.ScrolledWindow()
    win.add(scroller)
    scroller.add(main.web)
    win.show_all()

    fifo_fd = os.open('./qr_fifo', os.O_RDONLY)
    fifo_file = os.fdopen(fifo_fd)
    gtk.input_add(fifo_fd, gtk.gdk.INPUT_READ, handle_fifo, fifo_file)

    gtk.main()
Пример #2
0
 def add_read(self,fd,cb):
     "Hide differences between PyGTK versions"
     try:
         return gobject.io_add_watch(
             fd, gobject.IO_IN | gobject.IO_HUP, cb)
     except AttributeError as err:
         return gtk.input_add(fd, gtk.gdk.INPUT_READ, cb)
Пример #3
0
def burn(paths, progress):
    def cb(fd, cond):
        data = os.read(fd, 80)
        print data,
        if data.find('extents') >= 0:
            progress.set_fraction(1.0)
            progress.set_text('100%')
            return gtk.TRUE
        elif data.find('read/written') >= 0:
            progress.set_text('Finishing...')
        try:
            perc = int(data.split('.')[0])
            progress.set_fraction(perc/100.0)
            progress.set_text('%d%%' % (perc,))
        except (ValueError):
            pass
    command = burn_command(paths)
    print command
    pipe = popen2.Popen4(command)
    gtk.input_add(pipe.fromchild, gtk.gdk.INPUT_READ, cb)
    while pipe.poll() < 0:
        gtk.mainiteration()
    return pipe.poll()
Пример #4
0
def burn(paths, progress):
    def cb(fd, cond):
        data = os.read(fd, 80)
        print data,
        if data.find('extents') >= 0:
            progress.set_fraction(1.0)
            progress.set_text('100%')
            return gtk.TRUE
        elif data.find('read/written') >= 0:
            progress.set_text('Finishing...')
        try:
            perc = int(data.split('.')[0])
            progress.set_fraction(perc / 100.0)
            progress.set_text('%d%%' % (perc, ))
        except (ValueError):
            pass

    command = burn_command(paths)
    print command
    pipe = popen2.Popen4(command)
    gtk.input_add(pipe.fromchild, gtk.gdk.INPUT_READ, cb)
    while pipe.poll() < 0:
        gtk.mainiteration()
    return pipe.poll()
Пример #5
0
 def add_write(self, fd, cb):
     try:
         return gobject.io_add_watch(fd, gobject.IO_OUT | gobject.IO_HUP,
                                     cb)
     except AttributeError as err:
         return gtk.input_add(fd, gtk.gdk.INPUT_WRITE, cb)
Пример #6
0
 def add_read(self, fd, cb):
     "Hide differences between PyGTK versions"
     try:
         return gobject.io_add_watch(fd, gobject.IO_IN | gobject.IO_HUP, cb)
     except AttributeError as err:
         return gtk.input_add(fd, gtk.gdk.INPUT_READ, cb)
Пример #7
0
                gtk.mainquit()
            elif datas[0] == "ToFront":
                #print "ToFront"
                #print dir(getWidget("MidiProperties").get_window())
                getWidget("MidiProperties").get_window()._raise()
                s.send('confirm')
            elif datas[0] == "UpdatePatch":
                UpdateNotEmptyPatchDo(cPickle.loads(datas[1]))
                s.send('confirm')
            elif datas[0] == "UpdateEmptyPatch":
                UpdateEmptyPatchDo(cPickle.loads(datas[1]))
                s.send('confirm')
            elif datas[0] == "SetX11Window":
                x11window = datas[1]
                doxsend = 1
                s.send('confirm')
            elif datas[0] == "StopXSend":
                doxsend = 0
                s.send('confirm')
            else:
                print "Unknown message " + datas[
                    0] + " For X11_MidiProperties.py"
                s.send('confirm')

    OpenWindow()
    ConnectToRadium()
    gtk.input_add(s, gtk.GDK.INPUT_READ, callback)

    gtk.mainloop()
    s.close()
Пример #8
0
def addReader(reader):
    if not hasReader(reader):
        reads[reader] = gtk.input_add(reader, gtk.GDK.INPUT_READ, callback)
    simulate()
Пример #9
0
 def addReader(self, reader):
     if not hasReader(reader):
         reads[reader] = gtk.input_add(reader, gtk.GDK.INPUT_READ, self.callback)
Пример #10
0
 def addReader(self, reader):
     if not hasReader(reader):
         reads[reader] = gtk.input_add(reader, gtk.GDK.INPUT_READ,
                                       self.callback)
Пример #11
0
                perc = dl.get_current_fraction()
                bar.set_fraction(perc)
            return True

        self.idle_timeout = gtk.timeout_add(250, update_bars)

    def start_download(self, dl):
        error_stream = dl.start()

        def error_ready(src, cond):
            got = os.read(src.fileno(), 100)
            if not got:
                error_stream.close()
                self.n_downloads -= 1
                try:
                    data = dl.error_stream_closed()
                except download.DownloadError, ex:
                    dialog.alert(
                        self, "Error downloading '%s':\n\n%s" % (dl.url, ex))
                try:
                    policy.add_to_cache(dl.source, data)
                except SafeException, ex:
                    dialog.alert(self,
                                 "Error unpacking '%s':\n\n%s" % (dl.url, ex))
                return False
            dl.error_stream_data(got)
            return True

        self.n_downloads += 1
        gtk.input_add(error_stream, gtk.gdk.INPUT_READ, error_ready)
Пример #12
0
    (options, args) = parser.parse_args()

    # Start doing stuff

    if len(args) < 1:
        parser.error("Supply a FIFO or device filename")

    infile = open(args[0])
    fcntl.fcntl(infile, fcntl.F_SETFL, os.O_NONBLOCK)
    blocksize = options.blocksize

    if options.histogram:
        histogram = Histogram(options.histogram)

    if options.type == "uint8":
        typestring = "@%dB"
        datarange = (0, 255)
    elif options.type == "int8":
        typestring = "@%db"
        datarange = (-128, 127)
    else:
        parser.error("Unrecognized datatype")

    # Set up the GUI, register a watch on the FIFO, kickstart things
    colormap = makeColormap(datarange, options.colormap)
    gui = Gui(options.width, options.height, colormap, datarange, histogram,
              options.timestamps)
    plotter = gui.getPlotter()
    gtk.input_add(infile, gtk.gdk.INPUT_READ, readable)
    gui.run()
Пример #13
0
                #print "ToFront"
                #print dir(getWidget("MidiProperties").get_window())
                getWidget("MidiProperties").get_window()._raise()
                s.send('confirm')
            elif datas[0]=="UpdatePatch":
                UpdateNotEmptyPatchDo(cPickle.loads(datas[1]))
                s.send('confirm')
            elif datas[0]=="UpdateEmptyPatch":
                UpdateEmptyPatchDo(cPickle.loads(datas[1]))
                s.send('confirm')
            elif datas[0]=="SetX11Window":
                x11window=datas[1]
                doxsend=1
                s.send('confirm')
            elif datas[0]=="StopXSend":
                doxsend=0
                s.send('confirm')
            else:
                print "Unknown message "+datas[0]+" For X11_MidiProperties.py"
                s.send('confirm')
                

    OpenWindow()
    ConnectToRadium()
    gtk.input_add(s,gtk.GDK.INPUT_READ,callback)

    gtk.mainloop()
    s.close()


Пример #14
0
 def input_add(fd, cb):
     try:
         _throwback()
         return gobject.io_add_watch(fd, gobject.IO_IN | gobject.IO_HUP, cb)
     except AttributeError, err:
         return gtk.input_add(fd, gtk.gdk.INPUT_READ, cb)
Пример #15
0
 def addReader(self, reader):
     if reader not in self._reads:
         self._reads[reader] = gtk.input_add(reader, gtk.GDK.INPUT_READ, self.callback)
Пример #16
0
 def addWriter(self, writer):
     if writer not in self._writes:
         self._writes[writer] = gtk.input_add(writer, gtk.GDK.INPUT_WRITE, self.callback)
Пример #17
0
def addReader(reader):
    if not hasReader(reader):
        reads[reader] = gtk.input_add(reader, gtk.GDK.INPUT_READ, callback)
    simulate()
Пример #18
0
 def add_write(self,fd,cb):
     try:
         return gobject.io_add_watch(
             fd, gobject.IO_OUT | gobject.IO_HUP, cb)
     except AttributeError as err:
         return gtk.input_add(fd, gtk.gdk.INPUT_WRITE, cb)
Пример #19
0
 def input_add(fd,cb):
     try:
         _throwback()
         return gobject.io_add_watch(fd, gobject.IO_IN | gobject.IO_HUP, cb)
     except AttributeError, err:
         return gtk.input_add(fd, gtk.gdk.INPUT_READ, cb)
Пример #20
0
 def addWriter(self, writer):
     if not hasWriter(writer):
         writes[writer] = gtk.input_add(writer, gtk.GDK.INPUT_WRITE,
                                        self.callback)
Пример #21
0
    (options, args) = parser.parse_args()

    # Start doing stuff

    if len(args) < 1:
        parser.error("Supply a FIFO or device filename")

    infile = open(args[0])
    fcntl.fcntl(infile, fcntl.F_SETFL, os.O_NONBLOCK)
    blocksize = options.blocksize
    
    if options.histogram:
        histogram = Histogram(options.histogram)
    
    if options.type == "uint8":
        typestring = "@%dB"
        datarange = (0, 255)
    elif options.type == "int8":
        typestring = "@%db"
        datarange = (-128, 127)
    else:
        parser.error("Unrecognized datatype")
    
    # Set up the GUI, register a watch on the FIFO, kickstart things
    colormap = makeColormap(datarange, options.colormap)
    gui = Gui(options.width, options.height, colormap, datarange, histogram, options.timestamps)
    plotter = gui.getPlotter()
    gtk.input_add(infile, gtk.gdk.INPUT_READ, readable)
    gui.run()
Пример #22
0
 def addWriter(self, writer):
     if not hasWriter(writer):
         writes[writer] = gtk.input_add(writer, gtk.GDK.INPUT_WRITE, self.callback)
Пример #23
0
 def __init__(self, read_fd, sock):
     InteractiveInterpreter.__init__(self)
     self._rfd = os.fdopen(read_fd, 'r')
     self._sock = sock
     gtk.input_add(read_fd, GDK_INPUT_READ, self.input_func)