Ejemplo n.º 1
0
    def getsmBitmap(self, artid, client, size):
        global ImageData

        imageData = ImageData
        if not self.bitmaps.has_key(artid):
            if not imageData.has_key(artid): return None

            stream = cStringIO.StringIO(ImageData[artid])
            img = wxImageFromStream(stream)
            self.bitmaps[artid] = wxBitmapFromImage(img)
            stream.close()

        return self.bitmaps[artid]
Ejemplo n.º 2
0
    def getsmBitmap(self, artid, client, size):
        global ImageData

        imageData = ImageData
        if not self.bitmaps.has_key(artid):
            if not imageData.has_key(artid): return None

            stream = cStringIO.StringIO(ImageData[artid])
            img = wxImageFromStream(stream)
            self.bitmaps[artid] = wxBitmapFromImage(img)
            stream.close()

        return self.bitmaps[artid]
Ejemplo n.º 3
0
def getCollectionEditorBitmap():
    return wxBitmapFromImage(getCollectionEditorImage())
Ejemplo n.º 4
0
def getToolBitmap():
    return wxBitmapFromImage(getToolImage())
Ejemplo n.º 5
0
def getSaveBitmap():
    return wxBitmapFromImage(getSaveImage())
Ejemplo n.º 6
0
def getNewBitmap():
    return wxBitmapFromImage(getNewImage())
Ejemplo n.º 7
0
def getSmilesBitmap():
    return wxBitmapFromImage(getSmilesImage())
Ejemplo n.º 8
0
def getPublishBitmap():
    return wxBitmapFromImage(getPublishImage())
Ejemplo n.º 9
0
def getHelpBitmap():
    return wxBitmapFromImage(getHelpImage())
Ejemplo n.º 10
0
def getOutputErrorBitmap():
    return wxBitmapFromImage(getOutputErrorImage())
Ejemplo n.º 11
0
def getClassBrowserBitmap():
    return wxBitmapFromImage(getClassBrowserImage())
Ejemplo n.º 12
0
def getEditorBitmap():
    return wxBitmapFromImage(getEditorImage())
Ejemplo n.º 13
0
def getInspectorBitmap():
    return wxBitmapFromImage(getInspectorImage())
Ejemplo n.º 14
0
def getDesignerBitmap():
    return wxBitmapFromImage(getDesignerImage())
Ejemplo n.º 15
0
def getBoldBitmap():
    return wxBitmapFromImage(getBoldImage())
Ejemplo n.º 16
0
def getPreBitmap():
    return wxBitmapFromImage(getPreImage())
Ejemplo n.º 17
0
def getShellBitmap():
    return wxBitmapFromImage(getShellImage())
Ejemplo n.º 18
0
def getPyCrustBitmap():
    return wxBitmapFromImage(getPyCrustImage())
Ejemplo n.º 19
0
def getExplorerBitmap():
    return wxBitmapFromImage(getExplorerImage())
Ejemplo n.º 20
0
def getHVSplitBitmap():
    return wxBitmapFromImage(getHVSplitImage())
Ejemplo n.º 21
0
def getZopeBitmap():
    return wxBitmapFromImage(getZopeImage())
Ejemplo n.º 22
0
def getCopyBitmap():
    return wxBitmapFromImage(getCopyImage())
Ejemplo n.º 23
0
def OpenFile(parent, path):
    #FIXME: support: svg, sgvz, svg.gz with rsvg or batik (render to temporary
    #file /tmp/<PID><time()><atime(f.svg>.png and then open a frame)

    if not os.path.exists(path) or os.path.isdir(path): return
    frame = wxFrame(parent, -1, "File view: " + path, wxDefaultPosition, wxSize(500, 400))

    handled = 0
    needFrame = 1
    lowerPath = string.lower(path)
    #for animations or to see if count is > 0:
    #wxImage_GetImageCount(path)
    if lowerPath[-3:] in ("ani", "bmp", "cur", "gif", "ico", "iff", "jpg", "pcx", "png", "pnm", \
                          "tif", "xpm") or lowerPath[-4:] in ("jpeg", "tiff"):
        #f = open(path, "rb"); data = f.read(); f.close()
        #stream = StringIO(data)
        #img = wxImageFromStream(stream)
        img = wxEmptyImage()
        img.LoadFile(path)
        bmp = wxBitmapFromImage(img)
        #wxStaticBitmap(frame, -1, bmp) #, (15, 45))

        width, height = img.GetWidth(), img.GetHeight()
        if width and height:
            sw = wxScrolledWindow(frame, -1, wxDefaultPosition, wxDefaultSize,
                                  wxHSCROLL | wxVSCROLL)
            #sw.SetScrollbars(20, 20, img.GetWidth()/20, img.GetHeight()/20)
            sw.SetVirtualSize(wxSize(width, height))
            sw.SetScrollRate(20, 20)
            wxStaticBitmap(sw, -1, bmp) #, (15, 45))
            w, h = 800, 600 #frame.GetSize()
            w, h = min(w, width), min(h, height)
            minSize, b = 100, 10
            if w < minSize: w = minSize
            if h < minSize: h = minSize
            frame.SetSize(wxSize(w+b, h+b))
            handled = 1
    elif "html" == lowerPath[-4:] or "htm" == path[-3:]:
        htmlWin = wxHtmlWindow(frame)
        htmlWin.LoadPage(path)
        handled = 1
    elif "pdf" == lowerPath[-3:]:
        for cmd in ("xpdf", "acroread"):
            #FIXME: handle names that contain spaces etc.
            status, output = commands.getstatusoutput(cmd + " " + path)
            if 0 == status:
                handled = 1
                needFrame = 0
                break
    #FIXME: mplayer cannot run in background; same goes for Python calling mplayer externally - probably stdin dependence
    elif "mpeg" == lowerPath[-4:] or \
         lowerPath[-3:] in ("asf", "avi", "mov", "mpa", "mpg", "wmv"):
        for cmd in ("mplayer -quiet",):
            #FIXME: handle names that contain spaces etc.
            status, output = commands.getstatusoutput(cmd + " " + path)
            if 0 == status:
                handled = 1
                needFrame = 0
                break

    elif "ps" == lowerPath[-2:] or "ps.gz" == lowerPath[-5:]:
        pid = os.fork()
        if 0 == pid:
            for cmd in ("ggv", "gv"):
                try:
                    os.execlp(cmd, cmd, path)
                except OSError:
                    pass
            os.exit(1)
        handled = 1
        needFrame = 0

    if not handled:
        minSize = 65536
        try:
            f = open(path, "rb"); data = f.read(minSize); f.close()
        except IOError, ex:
            MsgOS(ex)
            return None
        txt = wxTextCtrl(frame, -1, data,
                         style=wxTE_READONLY|wxTE_MULTILINE|wxTE_DONTWRAP|wxHSCROLL)
        if len(data) == minSize:
            sizer = wxBoxSizer(wxVERTICAL)
            frame.SetAutoLayout(true)
            frame.SetSizer(sizer)
            frame.sizer = sizer
            b = wxButton(frame, -1, "Show entire file")
            sizer.Add(txt, 1, wxEXPAND|wxALL, 0)
            sizer.Add(b, 0, wxALIGN_CENTRE, 0)
            sizer.Layout()
Ejemplo n.º 24
0
def getItalicBitmap():
    return wxBitmapFromImage(getItalicImage())
Ejemplo n.º 25
0
def getBoaButtonBitmap():
    return wxBitmapFromImage(getBoaButtonImage())
Ejemplo n.º 26
0
def getPenBitmap():
    return wxBitmapFromImage(getPenImage())
Ejemplo n.º 27
0
def getDebuggerBitmap():
    return wxBitmapFromImage(getDebuggerImage())
Ejemplo n.º 28
0
def getBitmap():
    return wxBitmapFromImage(getImage())
Ejemplo n.º 29
0
def getCollectionEditorBitmap():
    return wxBitmapFromImage(getCollectionEditorImage())
Ejemplo n.º 30
0
def getSaveBitmap():
    return wxBitmapFromImage(getSaveImage())
Ejemplo n.º 31
0
def getDesignerBitmap():
    return wxBitmapFromImage(getDesignerImage())
Ejemplo n.º 32
0
def getItalicBitmap():
    return wxBitmapFromImage(getItalicImage())
Ejemplo n.º 33
0
def getInspectorBitmap():
    return wxBitmapFromImage(getInspectorImage())
Ejemplo n.º 34
0
def getToolBitmap():
    return wxBitmapFromImage(getToolImage())
Ejemplo n.º 35
0
def getEditorBitmap():
    return wxBitmapFromImage(getEditorImage())
Ejemplo n.º 36
0
def getPenBitmap():
    return wxBitmapFromImage(getPenImage())
Ejemplo n.º 37
0
def getClassBrowserBitmap():
    return wxBitmapFromImage(getClassBrowserImage())
Ejemplo n.º 38
0
def getMondrianBitmap():
    return wxBitmapFromImage(getMondrianImage())
Ejemplo n.º 39
0
def getOutputErrorBitmap():
    return wxBitmapFromImage(getOutputErrorImage())
Ejemplo n.º 40
0
def getBozoBitmap():
    return wxBitmapFromImage(getBozoImage())
Ejemplo n.º 41
0
def getHelpBitmap():
    return wxBitmapFromImage(getHelpImage())
Ejemplo n.º 42
0
def getLinkBitmap():
    return wxBitmapFromImage(getLinkImage())
Ejemplo n.º 43
0
def getShellBitmap():
    return wxBitmapFromImage(getShellImage())
Ejemplo n.º 44
0
def getPasteBitmap():
    return wxBitmapFromImage(getPasteImage())
Ejemplo n.º 45
0
def getExplorerBitmap():
    return wxBitmapFromImage(getExplorerImage())
Ejemplo n.º 46
0
def getUndoBitmap():
    return wxBitmapFromImage(getUndoImage())
Ejemplo n.º 47
0
def getZopeBitmap():
    return wxBitmapFromImage(getZopeImage())
Ejemplo n.º 48
0
def getBoldBitmap():
    return wxBitmapFromImage(getBoldImage())
Ejemplo n.º 49
0
def getLinkBitmap():
    return wxBitmapFromImage(getLinkImage())
Ejemplo n.º 50
0
def getPreBitmap():
    return wxBitmapFromImage(getPreImage())
Ejemplo n.º 51
0
def getNewBitmap():
    return wxBitmapFromImage(getNewImage())
Ejemplo n.º 52
0
def getPublishBitmap():
    return wxBitmapFromImage(getPublishImage())
Ejemplo n.º 53
0
def getPasteBitmap():
    return wxBitmapFromImage(getPasteImage())
Ejemplo n.º 54
0
def OpenFile(parent, path):
    #FIXME: support: svg, sgvz, svg.gz with rsvg or batik (render to temporary
    #file /tmp/<PID><time()><atime(f.svg>.png and then open a frame)

    if not os.path.exists(path) or os.path.isdir(path): return
    frame = wxFrame(parent, -1, "File view: " + path, wxDefaultPosition,
                    wxSize(500, 400))

    handled = 0
    needFrame = 1
    lowerPath = string.lower(path)
    #for animations or to see if count is > 0:
    #wxImage_GetImageCount(path)
    if lowerPath[-3:] in ("ani", "bmp", "cur", "gif", "ico", "iff", "jpg", "pcx", "png", "pnm", \
                          "tif", "xpm") or lowerPath[-4:] in ("jpeg", "tiff"):
        #f = open(path, "rb"); data = f.read(); f.close()
        #stream = StringIO(data)
        #img = wxImageFromStream(stream)
        img = wxEmptyImage()
        img.LoadFile(path)
        bmp = wxBitmapFromImage(img)
        #wxStaticBitmap(frame, -1, bmp) #, (15, 45))

        width, height = img.GetWidth(), img.GetHeight()
        if width and height:
            sw = wxScrolledWindow(frame, -1, wxDefaultPosition, wxDefaultSize,
                                  wxHSCROLL | wxVSCROLL)
            #sw.SetScrollbars(20, 20, img.GetWidth()/20, img.GetHeight()/20)
            sw.SetVirtualSize(wxSize(width, height))
            sw.SetScrollRate(20, 20)
            wxStaticBitmap(sw, -1, bmp)  #, (15, 45))
            w, h = 800, 600  #frame.GetSize()
            w, h = min(w, width), min(h, height)
            minSize, b = 100, 10
            if w < minSize: w = minSize
            if h < minSize: h = minSize
            frame.SetSize(wxSize(w + b, h + b))
            handled = 1
    elif "html" == lowerPath[-4:] or "htm" == path[-3:]:
        htmlWin = wxHtmlWindow(frame)
        htmlWin.LoadPage(path)
        handled = 1
    elif "pdf" == lowerPath[-3:]:
        for cmd in ("xpdf", "acroread"):
            #FIXME: handle names that contain spaces etc.
            status, output = commands.getstatusoutput(cmd + " " + path)
            if 0 == status:
                handled = 1
                needFrame = 0
                break
    #FIXME: mplayer cannot run in background; same goes for Python calling mplayer externally - probably stdin dependence
    elif "mpeg" == lowerPath[-4:] or \
         lowerPath[-3:] in ("asf", "avi", "mov", "mpa", "mpg", "wmv"):
        for cmd in ("mplayer -quiet", ):
            #FIXME: handle names that contain spaces etc.
            status, output = commands.getstatusoutput(cmd + " " + path)
            if 0 == status:
                handled = 1
                needFrame = 0
                break

    elif "ps" == lowerPath[-2:] or "ps.gz" == lowerPath[-5:]:
        pid = os.fork()
        if 0 == pid:
            for cmd in ("ggv", "gv"):
                try:
                    os.execlp(cmd, cmd, path)
                except OSError:
                    pass
            os.exit(1)
        handled = 1
        needFrame = 0

    if not handled:
        minSize = 65536
        try:
            f = open(path, "rb")
            data = f.read(minSize)
            f.close()
        except IOError, ex:
            MsgOS(ex)
            return None
        txt = wxTextCtrl(frame,
                         -1,
                         data,
                         style=wxTE_READONLY | wxTE_MULTILINE | wxTE_DONTWRAP
                         | wxHSCROLL)
        if len(data) == minSize:
            sizer = wxBoxSizer(wxVERTICAL)
            frame.SetAutoLayout(true)
            frame.SetSizer(sizer)
            frame.sizer = sizer
            b = wxButton(frame, -1, "Show entire file")
            sizer.Add(txt, 1, wxEXPAND | wxALL, 0)
            sizer.Add(b, 0, wxALIGN_CENTRE, 0)
            sizer.Layout()
Ejemplo n.º 55
0
def getCopyBitmap():
    return wxBitmapFromImage(getCopyImage())
Ejemplo n.º 56
0
def getBitmap():
    return wxBitmapFromImage(getImage())
Ejemplo n.º 57
0
def getUndoBitmap():
    return wxBitmapFromImage(getUndoImage())
Ejemplo n.º 58
0
def getHVSplitBitmap():
    return wxBitmapFromImage(getHVSplitImage())
Ejemplo n.º 59
0
def getDebuggerBitmap():
    return wxBitmapFromImage(getDebuggerImage())