Changeset 8988:7808a6aa0ab1 in orange


Ignore:
Timestamp:
09/20/11 13:14:25 (3 years ago)
Author:
matejd <matejd@…>
Branch:
default
Convert:
89ad833ebb92456f03e175d34c90d23ceb2d497b
Message:

Better handling when QtOpenGL is not installed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/OWDlgs.py

    r8987 r8988  
    99    _have_qwt = False 
    1010 
    11 from PyQt4.QtGui import QGraphicsScene, QGraphicsView 
     11_have_gl = True 
    1212try: 
    1313    from PyQt4.QtOpenGL import QGLWidget 
    14 except: 
    15     pass 
     14except ImportError: 
     15    _have_gl = False 
     16 
     17from PyQt4.QtGui import QGraphicsScene, QGraphicsView 
    1618from PyQt4.QtSvg import * 
    1719from ColorPalette import * 
     
    4749            self.customYEdit = OWGUI.lineEdit(OWGUI.indentedBox(box), self, "customY", "Height:", orientation = "horizontal", valueType = int) 
    4850            OWGUI.comboBoxWithCaption(self.space, self, "penWidthFactor", label = 'Factor:   ', box = " Pen width multiplication factor ",  tooltip = "Set the pen width factor for all curves in the plot\n(Useful for example when the lines in the plot look to thin)\nDefault: 1", sendSelectedValue = 1, valueType = int, items = range(1,20)) 
    49         elif isinstance(graph, QGraphicsScene) or isinstance(graph, QGraphicsView) or isinstance(graph, QGLWidget): 
     51        elif isinstance(graph, QGraphicsScene) or isinstance(graph, QGraphicsView) or (_have_gl and isinstance(graph, QGLWidget)): 
    5052            OWGUI.widgetLabel(box, "Image size will be set automatically.") 
    5153 
     
    5355        #self.printButton =          OWGUI.button(self.space, self, "Print", callback = self.printPic) 
    5456        self.saveImageButton =      OWGUI.button(box, self, "Save Image", callback = self.saveImage) 
    55         if not isinstance(graph, QGLWidget): 
     57        if not (_have_gl and isinstance(graph, QGLWidget)): 
    5658            self.saveMatplotlibButton = OWGUI.button(box, self, "Save Graph as matplotlib Script", callback = self.saveToMatplotlib) 
    5759        for (text, funct) in extraButtons: 
     
    7375        filename = fil + ext 
    7476        
    75         if isinstance(self.graph, QGLWidget): 
     77        if _have_gl and isinstance(self.graph, QGLWidget): 
    7678            img = self.graph.grabFrameBuffer() 
    7779            if size != None: 
Note: See TracChangeset for help on using the changeset viewer.