Exemple #1
0
    def _setupActions(self):
        """
        creates some actions needed on some menues and toolbars
        """
        a = self._actions["close_shell"] = qt.QAction( qt.QIconSet(qt.QPixmap(os.path.join(CONF.getIconsPath(),"newshell.png"))), "&Close Shell", qt.Qt.CTRL + qt.Qt.Key_W, self, "New Shell" )
        self.connect(a, qt.SIGNAL('activated()'), self.destroyShellTab)

        a = self._actions["new_shell"] = qt.QAction( qt.QIconSet(qt.QPixmap(os.path.join(CONF.getIconsPath(),"newshell.png"))), "&New Shell", qt.Qt.CTRL + qt.Qt.Key_T, self, "New Shell" )
        self.connect(a, qt.SIGNAL('activated()'), self.createShellTab)
Exemple #2
0
    def createIcons(self):
        configButton = qt.QIconViewItem(self.contentsWidget)
        configButton.setPixmap(
            qt.QPixmap(os.path.join(CONF.getIconsPath(), 'config.png')))
        configButton.setText("Configuration")

        updateButton = qt.QIconViewItem(self.contentsWidget)
        updateButton.setPixmap(
            qt.QPixmap(os.path.join(CONF.getIconsPath(), 'update.png')))
        updateButton.setText("Update")

        self.connect(self.contentsWidget, qt.SIGNAL('clicked(QIconViewItem*)'),
                     self.changePage)
    def setupNode(self):
        """ setupNode() -> build this object

        """
        self.clear()

        for k, v in self.node.current_data.items():
            try:
                throwaway = float(v)
                if int(throwaway) == -1:
                    raise TypeError('foo!')
            except (
                    TypeError,
                    ValueError,
            ):
                item = qt.QListViewItem(self, k, '%s' % (v, ))
            else:
                item = AccountValueListViewItem(self, k)
                item.setText(1, '%s' % v)
                pxm = qt.QPixmap(*self.swatchSize)
                color = self.plotDefs.get(k, qt.Qt.gray)
                pxm.fill(color)
                item.setPixmap(2, pxm)
                item.pixmapColor = color
                if k in self.plotDefs:
                    item.setOn(True)
 def getScreenShots(self):
     pixmaps = []
     for rect in self.getRegionRectangles():
         pixmap = qt.QPixmap(rect.size())
         self.ui.render(pixmap, qt.QPoint(), qt.QRegion(rect))
         pixmaps.append(pixmap)
     return pixmaps
Exemple #5
0
 def getIcon(cls):
     if cls.ID:
         pngFile = os.path.join(cls.RESOURCES_PATH, "Icons",
                                cls.ID + ".png")
         if os.path.exists(pngFile):
             return qt.QIcon(qt.QPixmap(pngFile))
     return None
Exemple #6
0
  def captureSliceFade(self, sliceNode, numberOfImages, outputDir,
                        outputFilenamePattern):
    if not sliceNode.IsMappedInLayout():
      raise ValueError('Selected slice view is not visible in the current layout.')

    if not os.path.exists(outputDir):
      os.makedirs(outputDir)
    filePathPattern = os.path.join(outputDir, outputFilenamePattern)

    sliceLogic = self.getSliceLogicFromSliceNode(sliceNode)
    sliceView = slicer.app.layoutManager().sliceWidget(sliceNode.GetLayoutName()).sliceView()
    compositeNode = sliceLogic.GetSliceCompositeNode()
    originalForegroundOpacity = compositeNode.GetForegroundOpacity()
    startForegroundOpacity = 0.0
    endForegroundOpacity = 1.0
    opacityStepSize = (endForegroundOpacity - startForegroundOpacity) / (numberOfImages - 1)
    for offsetIndex in range(numberOfImages):
      compositeNode.SetForegroundOpacity(startForegroundOpacity + offsetIndex * opacityStepSize)
      sliceView.forceRender()
      pixmap = qt.QPixmap().grabWidget(sliceView)
      filename = filePathPattern % offsetIndex
      self.addLog("Write " + filename)
      pixmap.save(filename)

    compositeNode.SetForegroundOpacity(originalForegroundOpacity)
Exemple #7
0
 def cursorForEffect(self, effectName):
     """Return an instance of QCursor customized for the given effectName.
 TODO: this could be moved to the EffectTool class so that effects can manage
 per-widget cursors, possibly turning them off or making them dynamic
 """
     if not effectName in self.effectCursors:
         baseImage = qt.QImage(":/Icons/AnnotationPointWithArrow.png")
         effectImage = qt.QImage(self.effectIconFiles[effectName])
         width = max(baseImage.width(), effectImage.width())
         pad = -9
         height = pad + baseImage.height() + effectImage.height()
         width = height = max(width, height)
         center = int(width / 2)
         cursorImage = qt.QImage(width, height, qt.QImage().Format_ARGB32)
         painter = qt.QPainter()
         cursorImage.fill(0)
         painter.begin(cursorImage)
         point = qt.QPoint(center - (baseImage.width() / 2), 0)
         painter.drawImage(point, baseImage)
         point.setX(center - (effectImage.width() / 2))
         point.setY(cursorImage.height() - effectImage.height())
         painter.drawImage(point, effectImage)
         painter.end()
         cursorPixmap = qt.QPixmap()
         cursorPixmap = cursorPixmap.fromImage(cursorImage)
         self.effectCursors[effectName] = qt.QCursor(
             cursorPixmap, center, 0)
     return self.effectCursors[effectName]
    def setColorPixmap(self):
        """ setColorPixmap() -> set a pixmap swatch for this button

        """
        pxm = qt.QPixmap(*self.swatchSize)
        pxm.fill(self.color)
        self.setPixmap(pxm)
Exemple #9
0
    def populate_widget(self, item):
        self._tree_view_item = item
        self.xrf_spectrum = item.get_model()
        self.data_path_widget.update_data_model(self.xrf_spectrum.path_template)
        self.count_time_ledit.setText(str(self.xrf_spectrum.count_time))

        executed = self.xrf_spectrum.is_executed()

        self.data_path_widget.setEnabled(not executed)
        self.other_parameters_gbox.setEnabled(not executed)
        self.mca_spectrum.setEnabled(executed)

        image = self.xrf_spectrum.centred_position.snapshot_image
        if image:
            try:
                w = image.width()
                h = image.height()
                ratio = w / float(h)
                h2 = (
                    self.data_path_widget.height() + self.other_parameters_gbox.height()
                )
                w2 = h2 * ratio
                image = image.scale(w2, h2)
                self.position_widget.child("svideo").setPixmap(qt.QPixmap(image))
            except BaseException:
                pass
Exemple #10
0
    def _init_toolbar( self ):
        basedir = matplotlib.rcParams[ 'datapath' ]
        
        for text, tooltip_text, image_file, callback in self.toolitems:
            if text == None:
                self.layout.addSpacing( 8 )
                continue
            
            fname = os.path.join( basedir, image_file )
            image = qt.QPixmap()
            image.load( fname )

            button = qt.QPushButton( qt.QIconSet( image ), "", self )
            qt.QToolTip.add( button, tooltip_text )

            # The automatic layout doesn't look that good - it's too close
            # to the images so add a margin around it.
            margin = 4
            button.setFixedSize( image.width()+margin, image.height()+margin )

            qt.QObject.connect( button, qt.SIGNAL( 'clicked()' ),
                                getattr( self, callback ) )
            self.layout.addWidget( button )

        # Add the x,y location widget at the right side of the toolbar
        # The stretch factor is 1 which means any resizing of the toolbar
        # will resize this label instead of the buttons.
        self.locLabel = qt.QLabel( "", self )
        self.locLabel.setAlignment( qt.Qt.AlignRight | qt.Qt.AlignVCenter )
        self.layout.addWidget( self.locLabel, 1 )
Exemple #11
0
 def SaveSegmentScreenShots(self, outputDir):
     layoutManager = slicer.app.layoutManager()
     threeDView = layoutManager.threeDWidget(0).threeDView()
     segmentationNodes = slicer.util.getNodes('vtkMRMLSegmentationNode*')
     for segmentationNode in segmentationNodes.values():
         segmentation = segmentationNode.GetSegmentation()
         segmentIDs = vtk.vtkStringArray()
         segmentation.GetSegmentIDs(segmentIDs)
         for segmentIDIndex in range(segmentIDs.GetNumberOfValues()):
             segmentID = segmentIDs.GetValue(segmentIDIndex)
             segment = segmentation.GetSegment(segmentID)
             filePath = self.CleanFilePath(outputDir, segmentID + '.png')
             bounds = [
                 0,
             ] * 6
             segment.GetBounds(bounds)
             center = [(bounds[0] + bounds[1]) / 2.,
                       (bounds[2] + bounds[3]) / 2.,
                       (bounds[4] + bounds[5]) / 2.]
             slicer.vtkMRMLSliceNode.JumpAllSlices(slicer.mrmlScene,
                                                   *center)
             slicer.util.delayDisplay("jumped to %s" % center, 100)
             threeDView.resetFocalPoint()
             qt.QPixmap().grabWidget(
                 slicer.util.mainWindow()).save(filePath)
             logging.error("Saved image to %s" % filePath)
Exemple #12
0
def testPreview():
    """
    """
    import sys
    import os.path

    if len(sys.argv) < 2:
        print("give an image file as parameter please.")
        sys.exit(1)

    if len(sys.argv) > 2:
        print("only one parameter please.")
        sys.exit(1)

    filename = sys.argv[1]

    a = qt.QApplication(sys.argv)
 
    p = qt.QPrinter()
    #p.setPrintToFile(1)
    p.setOutputToFile(1)
    p.setOutputFileName(os.path.splitext(filename)[0]+".ps")
    p.setColorMode(qt.QPrinter.Color)

    w = PrintPreview( parent = None, printer = p, name = 'Print Prev',
                      modal = 0, fl = 0)
    w.resize(400,500)

    w.addPixmap(qt.QPixmap(qt.QImage(filename)))
    #w.addImage(qt.QImage(filename))
    w.addImage(qt.QImage(filename))

    w.exec_loop()
 def _setIcon(self):
     owned = self.object.isOwned() if self.object is not None else False
     if owned:
         icon_name = "User%sOwned.png" % self.type
     else:
         _oper = self.object.getOS()
         if "LINUX" in _oper.upper():
             icon_name = "tux.png"    
         elif "WINDOWS" in _oper.upper():
             icon_name = "windows.png"    
         elif "APPLE" in _oper.upper():
             icon_name = "Apple.png"
         elif "MAC" in _oper.upper():
             icon_name = "Apple.png"
         elif "CISCO" in _oper.upper():
             icon_name = "Cisco.png"
         elif "IOS" in _oper.upper():
             icon_name = "Cisco.png"                
         elif "LINKSYS" in _oper.upper():
             icon_name = "Router.png"
         elif "ROUTER" in _oper.upper():
             icon_name = "Router.png"
         else:
             icon_name = "Tree%s-20.png" % self.type
         
         
     icon_path = os.path.join(CONF.getIconsPath(), icon_name)
     pm = qt.QPixmap(icon_path)
     self.setPixmap(0, pm)
Exemple #14
0
    def __init__(self, title, main_app, model_controller, plugin_manager):
        qt.QMainWindow.__init__(self, None, title, qt.Qt.WDestructiveClose)
        self.setWindowState(qt.Qt.WindowMaximized)
        self.setCaption(title)

        self.setIcon(
            qt.QPixmap(os.path.join(CONF.getIconsPath(), 'faraday_icon.png')))

        self._main_app = main_app
        self._model_controller = model_controller

        self._mainArea = qt.QHBox(self)
        self.setCentralWidget(self._mainArea)
        self._vb_splitter = qt.QSplitter(self._mainArea)
        self._vb_splitter.setOrientation(qt.QSplitter.Vertical)
        self._hb_splitter = qt.QSplitter(self._vb_splitter)
        self._hb_splitter.setOrientation(qt.QSplitter.Horizontal)

        self.statusBar().setSizeGripEnabled(False)

        self._shell_widgets = []
        self._notifications = []
        self._tab_manager = TabManager(self._hb_splitter)
        self._perspective_manager = PerspectiveManager(self._hb_splitter,
                                                       self._main_app)

        self._hosts_treeview = HostsBrowser(self._perspective_manager,
                                            self._model_controller, 'Hosts')
        notifier.registerWidget(self._hosts_treeview)

        self._perspective_manager.registerPerspective(self._hosts_treeview,
                                                      default=True)

        wtw = WorkspaceTreeWindow(self._perspective_manager, 'Workspaces',
                                  self._main_app.getWorkspaceManager())
        self._perspective_manager.registerPerspective(wtw)
        self._workspaces_treeview = wtw

        self._log_console = LogConsole(self._vb_splitter, 'Console')

        self._actions = dict()
        self._setupActions()

        self._menues = {}
        self._setupMenues()

        self.main_toolbar = qt.QToolBar(self, 'main toolbar')
        self._setupMainToolbar()

        self.location_toolbar = LocationToolbar(self, 'location toolbar')
        self.location_toolbar.setOffset(1500)

        self._status_bar_widgets = dict()
        self._setupStatusBar()

        self._is_shell_maximized = False

        self.shell_font = qt.QFont()
        self.shell_font.setRawName(CONF.getFont())
        self.setSizeFont()
Exemple #15
0
    def __init__(self, model_controller, plugin_manager, workspace_manager):
        FaradayUi.__init__(self, model_controller, plugin_manager,
                           workspace_manager)
        qt.QApplication.__init__(self, [])

        self._shell_envs = dict()

        model.guiapi.setMainApp(self)

        self._main_window = MainWindow(CONF.getAppname(), self,
                                       self.getModelController(),
                                       self.getPluginManager())
        self.setMainWidget(self.getMainWindow())

        notifier = model.log.getNotifier()
        notifier.widget = self._main_window
        model.guiapi.notification_center.registerWidget(self._main_window)

        self.loghandler = GUIHandler()
        addHandler(self.loghandler)

        self._splash_screen = qt.QSplashScreen(
            qt.QPixmap(os.path.join(CONF.getImagePath(), "splash2.png")),
            qt.Qt.WStyle_StaysOnTop)

        self.startSplashScreen()
Exemple #16
0
    def populate_widget(self, item):
        self._tree_view_item = item
        self.xrf_scan = item.get_model()
        self.data_path_widget.update_data_model(self.xrf_scan.path_template)
        self.count_time_ledit.setText(str(self.xrf_scan.count_time))

        executed = self.xrf_scan.is_executed()

        self.data_path_widget.setEnabled(not executed)
        self.other_parameters_gbox.setEnabled(not executed)
        self.mca_spectrum.setEnabled(executed)

        if executed:
            result = self.xrf_scan.get_scan_result()
            if not None in (result.mca_data, result.mca_calib,
                            result.mca_config):
                self.mca_spectrum.setData(result.mca_data, result.mca_calib,
                                          result.mca_config)
        else:
            self.mca_spectrum.clear()

        image = self.xrf_scan.centred_position.snapshot_image
        if image:
            try:
                w = image.width()
                h = image.height()
                ratio = w / float(h)
                h2 = self.data_path_widget.height(
                ) + self.other_parameters_gbox.height()
                w2 = h2 * ratio
                image = image.scale(w2, h2)
                self.position_widget.child("svideo").setPixmap(
                    qt.QPixmap(image))
            except:
                pass
    def contextMenuEvent(self, event):
        """ contextMenuEvent(event) -> display context menu

        """
        widget = self.childAt(event.pos())
        children, labels, lcds = self.summaryChildren()

        if widget in lcds:
            key = lcds[widget]
            lcd = widget
            label = self.summaries[key][0]
        elif widget in labels:
            key = labels[widget]
            lcd = self.summaries[key][1]
            label = widget
        else:
            event.ignore()
            return

        pop = kdeui.KPopupMenu(self)
        self.context = (key, label, lcd)

        item = pop.insertItem(util.loadIconSet('up'), i18n('Move Up'),
                              self.moveSummary)
        pop.setItemParameter(item, 0)
        if not children.index(label):
            pop.setItemEnabled(item, False)

        item = pop.insertItem(util.loadIconSet('down'), i18n('Move Down'),
                              self.moveSummary)
        pop.setItemParameter(item, 1)
        if children.index(lcd) + 1 == len(children):
            pop.setItemEnabled(item, False)

        pop.insertSeparator()
        item = pop.insertItem(util.loadIconSet('remove'),
                              i18n('Remove "%s"' % (key, )),
                              self.removeSummary)
        pop.insertSeparator()
        for index, label, color in ((0, 'Background color...',
                                     lcd.paletteBackgroundColor()),
                                    (1, 'Foreground color...',
                                     lcd.paletteForegroundColor())):

            item = pop.insertItem('', self.selectColor)
            pixmap = qt.QPixmap(16, 16)
            pixmap.fill(color)
            icons = qt.QIconSet(pixmap)
            pop.changeItem(item, icons, i18n(label))
            pop.setItemParameter(item, index)

        pop.insertSeparator()
        for label, style, icon in lcdStyles:
            item = pop.insertItem(util.loadIconSet(icon), i18n(label),
                                  self.selectSegmentStyle)
            pop.setItemParameter(item, style)
            pop.setItemChecked(item, style == lcd.segmentStyle())

        pop.popup(event.globalPos())
Exemple #18
0
    def update_pin_icon(self):
        dc_tree_widget = self.listView().parent()

        if dc_tree_widget._loaded_sample_item:
            dc_tree_widget._loaded_sample_item.setPixmap(0, qt.QPixmap())

        dc_tree_widget._loaded_sample_item = self
        self.setPixmap(0, dc_tree_widget.pin_pixmap)
 def buttonIcon(self):
     if not self.FILE_NAME:
         return None
     iconPath = os.path.join(
         os.path.dirname(inspect.getfile(self.__class__)),
         '../Resources/Icons', self.FILE_NAME)
     pixmap = qt.QPixmap(iconPath)
     return qt.QIcon(pixmap)
Exemple #20
0
 def image(self, filename):
     """Displays the image contained in filename"""
     self._init(filename)
     self._sw = qt.QScrollView(self, "scrollView")
     label = qt.QLabel(self)
     label.setPixmap(qt.QPixmap(filename))
     self._sw.addChild(label)
     self._sw.show()
Exemple #21
0
 def _setIcon(self):
     if self.object == "CouchDB":
         icon_name = "TreeRoot-20.png"
     else:
         icon_name = "TreeOffRoot-20.png"
     icon_path = os.path.join(CONF.getIconsPath(), icon_name)
     pm = qt.QPixmap(icon_path)
     self.setPixmap(0, pm)
Exemple #22
0
 def onShowImage(self, value=False):
   self.showImage = value
   if value:
     self.imageLabel.show()
   else:
     self.imageLabel.hide()
     pixmap = qt.QPixmap()
     self.imageLabel.setPixmap(pixmap)
 def _setIcon(self):
     
     if self.object.__class__.__name__ == "WorkspaceOnCouch":
         icon_name = "TreeRoot-20.png"
     else:
         icon_name = "TreeOffRoot-20.png"
     icon_path = os.path.join(CONF.getIconsPath(), icon_name)
     pm = qt.QPixmap(icon_path)
     self.setPixmap(0, pm)
 def createAndGetRawColoredPixelMap(color,
                                    width=24,
                                    height=24,
                                    drawBorder=True):
     pixmap = qt.QPixmap(width, height)
     pixmap.fill(qt.QColor(color))
     if drawBorder:
         ModuleWidgetMixin.drawBorder(pixmap)
     return ModuleWidgetMixin.pixelmapAsRaw(pixmap)
Exemple #25
0
def getPixmap(name):
    if name not in _pixmap:
        filename = getImagePath(name)
        if os.path.isfile(filename):
            pixmap = qt.QPixmap(filename)
            _pixmap[name] = pixmap
        else:
            raise Error, _("Image '%s' not found") % name
    return _pixmap[name]
Exemple #26
0
 def setIconColor(self, color):
     """
     internal method to change the color of the icon
     """
     r = color.red()
     g = color.green()
     b = color.blue()
     paintbrush_xpm[8] = "j  c #%02x%02x%02x"%(r, g, b)
     self.setPixmap(qt.QPixmap(paintbrush_xpm))
Exemple #27
0
def add_image(path):
    logo_label = qt.QLabel()
    logo_label.setAlignment(4)
    print('loading')
    logo_pixmap = \
        qt.QPixmap(path)
    logo_label.setPixmap(logo_pixmap)

    return logo_label, logo_pixmap
Exemple #28
0
 def __init__(self, x, y, img, canvas):
     """
     """
     PrintCanvasRectangle.__init__(self, x, y,         \
                                   img.width(), img.height(), canvas, 1)
     self.image = img
     self.pixmap = qt.QPixmap(img)
     self.pixmap.setOptimization(qt.QPixmap.BestOptim)
     self.imageWidth = float(img.width())
     self.fullRedrawFlag = 1
Exemple #29
0
 def getHeader(self, addlink=None):
     link = [
         ['http://www.esrf.fr', 'ESRF home'],
         ['http://www.esrf.fr/computing/bliss/', 'BLISS home'],
     ]
     if addlink is not None:
         for item in addlink:
             link.append(item)
     text = ""
     text += "<HTML>"
     text += "<HEAD>"
     text += "<TITLE>PyMCA : Advanced Fit Results</TITLE>"
     text += "</HEAD>"
     text += "<BODY TEXT=#000000 BGCOLOR=#FFFFFF ALINK=#ff6600 LINK=#0000cc VLINK=#0000cc marginwidth=10 marginheight=10  topmargin=10 leftmargin=10>"
     text += "<CENTER>"
     text += "<TABLE WIDTH=100%% border=0 Height=70>"
     text += "  <TR>"
     text += "    <TD><Font Size=5 Color=#0000cc>"
     text += "        <b>PyMCA : Advanced Fit Results</b></Font>"
     text += "    </td>"
     text += "    <td rowspan=2 ALIGN=RIGHT VALIGN=bottom>"
     text += "        <a HREF=" "http://www.esrf.fr/" ">"
     logofile = self.htmldir + "/" + "PyMcaLogo.png"
     if not os.path.exists(logofile):
         try:
             import qt
             pixmap = qt.QPixmap(PyMcaLogo.PyMcaLogo)
             pixmap.save(logofile, "PNG")
         except:
             pass
     text += "        <img SRC=%s ALT=" "ESRF home" " WIDTH=55 HEIGHT=68 BORDER=0></a>" % "PyMcaLogo.png"
     text += "    </td>"
     text += "  </tr>"
     text += "  <tr>"
     text += "     <td width=100%%  VALIGN=bottom>"
     text += "        <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%%>"
     text += "          <TR>"
     text += "            <TD WIDTH=100%% BGCOLOR=#ee22aa HEIGHT=17  ALIGN=LEFT VALIGN=middle>"
     text += "            <FONT color=#000000>&nbsp;"
     for name in link:
         text += "|&nbsp;&nbsp;<A STYLE=" "color: #FFFFFF" " HREF=" "%s" ">%s</a>&nbsp;&nbsp;" % (
             tuple(name))
     text += "            </FONT>"
     text += "            </TD>"
     text += "          </TR>"
     text += "        </TABLE>"
     text += "     </td>"
     text += "  </tr>"
     text += "  <tr>"
     text += "     <td colspan=2 height=5><spacer type=block height=10 width=0>"
     text += "     </td>"
     text += "  </tr>"
     text += "</table>"
     text += "</center>"
     return text
Exemple #30
0
    def __init__(self):
        super().__init__()

        effectPixmap = qt.QPixmap(
            os.path.join(
                os.path.split(WarpDrive.__file__)[0], 'Resources', 'Icons',
                'Add.png'))
        effectIcon = qt.QIcon(effectPixmap)
        self.addButton = qt.QToolButton()
        self.addButton.setToolButtonStyle(qt.Qt.ToolButtonTextUnderIcon)
        self.addButton.setIcon(effectIcon)
        self.addButton.setIconSize(effectPixmap.rect().size())
        self.addButton.setEnabled(True)
        self.addButton.setSizePolicy(qt.QSizePolicy.MinimumExpanding,
                                     qt.QSizePolicy.Maximum)
        self.addButton.clicked.connect(self.onAddButton)

        effectPixmap = qt.QPixmap(
            os.path.join(
                os.path.split(WarpDrive.__file__)[0], 'Resources', 'Icons',
                'Delete.png'))
        effectIcon = qt.QIcon(effectPixmap)
        self.removeButton = qt.QToolButton()
        self.removeButton.setToolButtonStyle(qt.Qt.ToolButtonTextUnderIcon)
        self.removeButton.setIcon(effectIcon)
        self.removeButton.setText('Delete')
        self.removeButton.setIconSize(effectPixmap.rect().size())
        self.removeButton.setEnabled(True)
        self.removeButton.setSizePolicy(qt.QSizePolicy.MinimumExpanding,
                                        qt.QSizePolicy.Maximum)
        self.removeButton.clicked.connect(self.onRemoveButton)

        self.buttonsFrame = qt.QFrame()
        self.buttonsFrame.setSizePolicy(qt.QSizePolicy.Preferred,
                                        qt.QSizePolicy.Minimum)
        self.buttonsFrame.setLayout(qt.QHBoxLayout())
        self.buttonsFrame.layout().addWidget(self.addButton, 1)
        self.buttonsFrame.layout().addWidget(self.removeButton, 1)

        layout = qt.QVBoxLayout(self)
        layout.addWidget(self.buttonsFrame)
        layout.addWidget(self.view)