Exemple #1
0
    def __init__(self, parent = None, name = None, modal = False):
        """
        Constructor
        """
        QDialog.__init__(self, parent)
        if name:
            self.setObjectName(name)
        self.setModal(modal)
        self.setupUi(self)

        #center this window 
        screen = QDesktopWidget().screenGeometry()
        size = self.geometry()
        self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)
        
        self.keyIndex = 0
        self.keys = [0, 0, 0, 0]
        
        self.objectType = None
        
        self.connect(self.primaryClearButton, SIGNAL("clicked()"), self.__clear)

        
        self.shortcutsGroup.installEventFilter(self)

        
        self.primaryClearButton.installEventFilter(self)
        
        
        self.buttonBox.button(QDialogButtonBox.Ok).installEventFilter(self)
        self.buttonBox.button(QDialogButtonBox.Cancel).installEventFilter(self)
Exemple #2
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self.webview = parent
        #center this window
        screen = QDesktopWidget().screenGeometry()
        size = self.geometry()
        self.move((screen.width() - size.width()) / 2,
                  (screen.height() - size.height()) / 2)

        self.preview.setHtml("<img src='../../images/logo.png'></img>",
                             baseUrl=QUrl(os.getcwd() + "/support/image.html"))

        QObject.connect(self.btn, SIGNAL("clicked (QAbstractButton *)"),
                        self.evt_btn_click)
        QObject.connect(self.uri, SIGNAL("textChanged (const QString&)"),
                        self.evt_preview)
        QObject.connect(self.width, SIGNAL("valueChanged (const QString&)"),
                        self.evt_preview)
        QObject.connect(self.height, SIGNAL("valueChanged (const QString&)"),
                        self.evt_preview)
        QObject.connect(self.vspace, SIGNAL("valueChanged (const QString&)"),
                        self.evt_preview)
        QObject.connect(self.hspace, SIGNAL("valueChanged (const QString&)"),
                        self.evt_preview)
        QObject.connect(self.border, SIGNAL("valueChanged (const QString&)"),
                        self.evt_preview)
        QObject.connect(self.alignment, SIGNAL("currentIndexChanged (int)"),
                        self.evt_preview)
Exemple #3
0
    def __init__(self,parent = None):
        """
        Constructor
        """
        QDialog.__init__(self,parent)
        self.setupUi(self)


        #center this window 
        screen = QDesktopWidget().screenGeometry()
        size = self.geometry()
        self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)
        
        self.baseConfigItem={
                    "applicationPage":[QApplication.translate("ApplicationPage","Application"),getPath("iconDir","preferences-application.png"),"sklib.ui.cpages.applicationPage",None],
                    "shortcutsPage":[QApplication.translate("ShortcutsPage","Shortcuts"),getPath("iconDir","preferences-shortcuts.png"),"sklib.ui.cpages.shortcutsPage","applicationPage"],
                    }
        #read from plugins 
        for plugin in PluginAdapter().new().getPlugins():
            if hasattr(plugin,"getConfigPages"):
                ptems = plugin.getConfigPages()
                for pkey in ptems.keys():
                    if not self.baseConfigItem.__contains__(pkey):
                        self.baseConfigItem[pkey]=ptems[pkey]
        #end plugin parse
        self.itmDict = {}
        self.setupTreeList()
        self.btn.button(QDialogButtonBox.Apply).setEnabled(False)
        QObject.connect(self.configItemList, SIGNAL("itemClicked (QTreeWidgetItem *,int)"),self.evt_click)
        QObject.connect(self.btn, SIGNAL("clicked (QAbstractButton *)"),self.evt_btn_click)
Exemple #4
0
    def __init__(self, parent=None, name=None, modal=False):
        """
        Constructor
        """
        QDialog.__init__(self, parent)
        if name:
            self.setObjectName(name)
        self.setModal(modal)
        self.setupUi(self)

        #center this window
        screen = QDesktopWidget().screenGeometry()
        size = self.geometry()
        self.move((screen.width() - size.width()) / 2,
                  (screen.height() - size.height()) / 2)

        self.keyIndex = 0
        self.keys = [0, 0, 0, 0]

        self.objectType = None

        self.connect(self.primaryClearButton, SIGNAL("clicked()"),
                     self.__clear)

        self.shortcutsGroup.installEventFilter(self)

        self.primaryClearButton.installEventFilter(self)

        self.buttonBox.button(QDialogButtonBox.Ok).installEventFilter(self)
        self.buttonBox.button(QDialogButtonBox.Cancel).installEventFilter(self)
Exemple #5
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self.connectSignals()
        self.parent = parent

        self.generalSettings = GeneralSettings(self)
        self.cacheSettings = CacheSettings(self)
        self.repositorySettings = RepositorySettings(self)
        self.proxySettings = ProxySettings(self)
Exemple #6
0
 def __init__(self,parent=None):
     QDialog.__init__(self,parent)
     self.setupUi(self)
     self.webview = parent
     #center this window 
     screen = QDesktopWidget().screenGeometry()
     size = self.geometry()
     self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)
     
     QObject.connect(self.btn, SIGNAL("clicked (QAbstractButton *)"),self.evt_btn_click)
Exemple #7
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self.connectSignals()
        self.parent = parent

        self.generalSettings = GeneralSettings(self)
        self.cacheSettings = CacheSettings(self)
        self.repositorySettings = RepositorySettings(self)
        self.proxySettings = ProxySettings(self)
Exemple #8
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        self.setupUi(self)
        self.webview = parent
        #center this window
        screen = QDesktopWidget().screenGeometry()
        size = self.geometry()
        self.move((screen.width() - size.width()) / 2,
                  (screen.height() - size.height()) / 2)

        QObject.connect(self.btn, SIGNAL("clicked (QAbstractButton *)"),
                        self.evt_btn_click)
Exemple #9
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        self.setupUi(self)
        
        repo_url = (u'<address><b>https://github.com/GobiernoLaRioja/' +
                    u'forestroaddesigner</address></b>')
        tracker_url = (u'<address><b>https://github.com/GobiernoLaRioja/' +
                       u'forestroaddesigner/issues</address></b><br>')
        panoi_url = u'<address><b>www.panoimagen.com</address></b><br>'
        
        repository_info = (u'Code repository: {}<br>Bug Tracker: {}'.format(
                repo_url, tracker_url))
        
        contact_info = (u'<h3>Copyright (C) 2017  by PANOimagen S.L.</h3>' +
                        u'PANOimagen S.L. La Rioja (Spain) -- {}'.format(
                                panoi_url))

        plugin_description = (u'This plugin has been funded by the Dirección' +
                              u' General de Tecnologías de la Información' +
                              u' y la Comunicación\ndel Gobierno de La Rioja'+
                              u' and developed by PANOimagen S.L. at the' +
                              u' request of the Dirección General\ndel' +
                              u' Gobierno de La Rioja.\n\nForest Road' +
                              u' Designer serves as support of foresters'+
                              u' in the design of forest roads.\n' +
                              u'For more information, please, read metadata/' +
                              u'readme and/or contact the author.')
        
        license_info = (u'<h3>License:' +
                        u'</h3>This program is free software' +
                        u' you can redistribute it and/or modify it under' +
                        u' the terms of the GNU General<br>Public License as' +
                        u' published by the Free Software Foundation, either' +
                        u' version 3 of the License, or (at your<br>option)' +
                        u' any later version.<br><br>This program is' +
                        u' distributed in the hope that it will be useful,' +
                        u' but WITHOUT ANY WARRANTY; without even<br>the' +
                        u' implied warranty of MERCHANTABILITY or FITNESS' +
                        u' FOR A PARTICULAR PURPOSE.  See the GNU General' +
                        u'<br>Public License for more details.<br><br>' +
                        u'You should have received a copy of the GNU' +
                        u' General Public License along with this program.' +
                        u' If not, see:<br><address><b>https://www.gnu.org/' +
                        u'licenses/</address></b>.')
        
        self.codeRepoLabel.setText(repository_info)
        self.contactLabel.setText(contact_info)
        self.descriptionLabel.setText(plugin_description)
        self.licenseLabel.setText(license_info)
        self.versionLabel.setText(u'<h2>Forest Road Designer<\h2>' +
                                  u' Version {}'.format(
                                          version.VERSION))
Exemple #10
0
 def __init__(self,parent,ele):      
     QDialog.__init__(self,parent)
     self.setupUi(self)
     
     self.ele = ele 
     
     self.styleValue.setPlainText(self.ele.attribute("style",""))
     #center this window 
     screen = QDesktopWidget().screenGeometry()
     size = self.geometry()
     self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)
     
     QObject.connect(self.btn, SIGNAL("clicked (QAbstractButton *)"),self.evt_btn_click)
Exemple #11
0
    def __init__(self, parent, ele):
        QDialog.__init__(self, parent)
        self.setupUi(self)

        self.ele = ele

        self.styleValue.setPlainText(self.ele.attribute("style", ""))
        #center this window
        screen = QDesktopWidget().screenGeometry()
        size = self.geometry()
        self.move((screen.width() - size.width()) / 2,
                  (screen.height() - size.height()) / 2)

        QObject.connect(self.btn, SIGNAL("clicked (QAbstractButton *)"),
                        self.evt_btn_click)
Exemple #12
0
 def __init__(self):
     QDialog.__init__(self)
     self.setWindowTitle(translations.TR_PLUGIN_ERROR_REPORT)
     self.resize(600, 400)
     vbox = QVBoxLayout(self)
     label = QLabel(translations.TR_SOME_PLUGINS_REMOVED)
     vbox.addWidget(label)
     self._tabs = QTabWidget()
     vbox.addWidget(self._tabs)
     hbox = QHBoxLayout()
     btnAccept = QPushButton(translations.TR_ACCEPT)
     btnAccept.setMaximumWidth(100)
     hbox.addWidget(btnAccept)
     vbox.addLayout(hbox)
     #signals
     self.connect(btnAccept, SIGNAL("clicked()"), self.close)
Exemple #13
0
 def __init__(self,parent=None):
     QDialog.__init__(self,parent)
     self.setupUi(self)
     
     #center this window 
     screen = QDesktopWidget().screenGeometry()
     size = self.geometry()
     self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)
     
     QObject.connect(self.pluginList, SIGNAL("customContextMenuRequested (const QPoint&)"),self.__evt_contextmenu)
     QObject.connect(self.update,SIGNAL("clicked ()"),self.__evt_update)
     
     self.__http = None 
     self.__downloadFile = None
     self.__baseUrl = "http://localhost/"
     self.plugin_txt_url.setText("%splugins.txt"%self.__baseUrl)
     self.__evt_update()
    def __init__(self, parent):
        QDialog.__init__(self, parent, Qt.Dialog)
        self.setWindowTitle(translations.TR_PLUGIN_MANAGER)
        self.resize(700, 600)

        vbox = QVBoxLayout(self)
        self._tabs = QTabWidget()
        vbox.addWidget(self._tabs)
        self._txt_data = QTextBrowser()
        self._txt_data.setOpenLinks(False)
        vbox.addWidget(QLabel(translations.TR_PROJECT_DESCRIPTION))
        vbox.addWidget(self._txt_data)
        # Footer
        hbox = QHBoxLayout()
        btn_close = QPushButton(translations.TR_CLOSE)
        btnReload = QPushButton(translations.TR_RELOAD)
        hbox.addWidget(btn_close)
        hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
        hbox.addWidget(btnReload)
        vbox.addLayout(hbox)
        self.overlay = ui_tools.Overlay(self)
        self.overlay.hide()

        self._oficial_available = []
        self._community_available = []
        self._locals = []
        self._updates = []
        self._loading = True
        self._requirements = {}

        self.connect(btnReload, SIGNAL("clicked()"), self._reload_plugins)
        self.thread = ThreadLoadPlugins(self)
        self.connect(self.thread, SIGNAL("finished()"),
                     self._load_plugins_data)
        self.connect(self.thread, SIGNAL("plugin_downloaded(PyQt_PyObject)"),
                     self._after_download_plugin)
        self.connect(self.thread,
                     SIGNAL("plugin_manually_installed(PyQt_PyObject)"),
                     self._after_manual_install_plugin)
        self.connect(self.thread, SIGNAL("plugin_uninstalled(PyQt_PyObject)"),
                     self._after_uninstall_plugin)
        self.connect(self._txt_data, SIGNAL("anchorClicked(const QUrl&)"),
                     self._open_link)
        self.connect(btn_close, SIGNAL('clicked()'), self.close)
        self.overlay.show()
        self._reload_plugins()
Exemple #15
0
    def __init__(self,parent=None):
        QDialog.__init__(self,parent)
        self.setupUi(self)

        #center this window 
        screen = QDesktopWidget().screenGeometry()
        size = self.geometry()
        self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)
        
        for item in PluginAdapter().new().readInfos():
            itree = QTreeWidgetItem()
            for i in range(6):
                itree.setText(i,str(item[i]))
                
            self.pluginList.addTopLevelItem(itree)
            
        
        QObject.connect(self.pluginList, SIGNAL("customContextMenuRequested (const QPoint&)"),self.__evt_contextmenu)
Exemple #16
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        self.setupUi(self)

        #center this window
        screen = QDesktopWidget().screenGeometry()
        size = self.geometry()
        self.move((screen.width() - size.width()) / 2,
                  (screen.height() - size.height()) / 2)

        QObject.connect(self.pluginList,
                        SIGNAL("customContextMenuRequested (const QPoint&)"),
                        self.__evt_contextmenu)
        QObject.connect(self.update, SIGNAL("clicked ()"), self.__evt_update)

        self.__http = None
        self.__downloadFile = None
        self.__baseUrl = "http://localhost/"
        self.plugin_txt_url.setText("%splugins.txt" % self.__baseUrl)
        self.__evt_update()
Exemple #17
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        self.setupUi(self)

        #center this window
        screen = QDesktopWidget().screenGeometry()
        size = self.geometry()
        self.move((screen.width() - size.width()) / 2,
                  (screen.height() - size.height()) / 2)

        for item in PluginAdapter().new().readInfos():
            itree = QTreeWidgetItem()
            for i in range(6):
                itree.setText(i, str(item[i]))

            self.pluginList.addTopLevelItem(itree)

        QObject.connect(self.pluginList,
                        SIGNAL("customContextMenuRequested (const QPoint&)"),
                        self.__evt_contextmenu)
Exemple #18
0
 def __init__(self,parent=None):
     QDialog.__init__(self,parent)
     self.setupUi(self)
     self.webview = parent
     #center this window 
     screen = QDesktopWidget().screenGeometry()
     size = self.geometry()
     self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)
     
     self.preview.setHtml("<img src='../../images/logo.png'></img>",baseUrl=QUrl(os.getcwd()+"/support/image.html"))
     
     
     QObject.connect(self.btn, SIGNAL("clicked (QAbstractButton *)"),self.evt_btn_click)
     QObject.connect(self.uri,SIGNAL("textChanged (const QString&)"),self.evt_preview)
     QObject.connect(self.width,SIGNAL("valueChanged (const QString&)"),self.evt_preview)
     QObject.connect(self.height,SIGNAL("valueChanged (const QString&)"),self.evt_preview)
     QObject.connect(self.vspace,SIGNAL("valueChanged (const QString&)"),self.evt_preview)
     QObject.connect(self.hspace,SIGNAL("valueChanged (const QString&)"),self.evt_preview)
     QObject.connect(self.border,SIGNAL("valueChanged (const QString&)"),self.evt_preview)
     QObject.connect(self.alignment,SIGNAL("currentIndexChanged (int)"),self.evt_preview)
Exemple #19
0
    def __init__(self, parent, help):
        QDialog.__init__(self, parent)

        self.setWindowTitle(i18n("Package Manager Help"))
        self.resize(700, 500)
        self.setModal(True)

        self.layout = QGridLayout(self)
        self.htmlPart = QTextBrowser(self)
        self.layout.addWidget(self.htmlPart, 1, 1)

        locale = setSystemLocale(justGet=True)

        if locale in ["tr", "es", "en", "fr", "nl", "de", "sv"]:
            self.htmlPart.setSource(
                QUrl("/usr/share/package-manager/help/%s/%s" %
                     (locale, help_files[help])))

        else:
            self.htmlPart.setSource(
                QUrl("/usr/share/package-manager/help/en/%s" %
                     help_files[help]))
Exemple #20
0
    def __init__(self, parent, help):
        QDialog.__init__(self, parent)

        self.setWindowTitle(i18n("Package Manager Help"))
        self.resize(700,500)
        self.setModal(True)

        self.layout = QGridLayout(self)
        self.htmlPart = QTextBrowser(self)
        self.layout.addWidget(self.htmlPart, 1, 1)

        locale = setSystemLocale(justGet = True)

        if locale in ["tr", "es", "en", "fr", "nl", "de", "sv"]:
            self.htmlPart.setSource(
                    QUrl("/usr/share/package-manager/help/%s/%s" %
                        (locale, help_files[help])))

        else:
            self.htmlPart.setSource(
                    QUrl("/usr/share/package-manager/help/en/%s" %
                        help_files[help]))
 def __init__(self, parent):
     QDialog.__init__(self, parent)
     self.keys = 0
     #Keyword modifiers!
     self.keyword_modifiers = (Qt.Key_Control, Qt.Key_Meta, Qt.Key_Shift,
                               Qt.Key_Alt, Qt.Key_Menu)
     #main layout
     main_vbox = QVBoxLayout(self)
     self.line_edit = QLineEdit()
     self.line_edit.setReadOnly(True)
     #layout for buttons
     buttons_layout = QHBoxLayout()
     ok_button = QPushButton(translations.TR_ACCEPT)
     cancel_button = QPushButton(translations.TR_CANCEL)
     #add widgets
     main_vbox.addWidget(self.line_edit)
     buttons_layout.addWidget(ok_button)
     buttons_layout.addWidget(cancel_button)
     main_vbox.addLayout(buttons_layout)
     self.line_edit.installEventFilter(self)
     #buttons signals
     self.connect(ok_button, SIGNAL("clicked()"), self.save_shortcut)
     self.connect(cancel_button, SIGNAL("clicked()"), self.close)
Exemple #22
0
    def __init__(self, app=None, packages=[], hide_summary=False):
        QDialog.__init__(self, None)
        self.setupUi(self)

        self.hide_summary = hide_summary
        self.state = StateManager(self)
        self.iface = self.state.iface
        self.state._selected_packages = packages
        self._packages = packages[:]
        self._started = False

        self._postexceptions = [lambda: sys.exit(1)]

        # Check if another pisi instance already running
        if isPisiRunning():
            self.exceptionCaught("ALREADY RUNNING", block=True)

        # Check given package names available in repositories
        if not any(package.endswith('.pisi') for package in packages):
            available_packages = self.state.packages()
            for package in packages:
                if package not in available_packages:
                    self.exceptionCaught('HTTP Error 404', package, block=True)

        # Check if local/remote packages mixed with repo packages
        # which pisi does not support to handle these at the same time
        else:
            if not all(package.endswith('.pisi') for package in packages):
                self.exceptionCaught('MIXING PACKAGES', block=True)

            # Check given local packages if exists
            for package in get_real_paths(packages):
                if '://' not in package and package.endswith('.pisi'):
                    if not os.path.exists(package):
                        self.exceptionCaught('FILE NOT EXISTS',
                                             package,
                                             block=True)

        self.state.state = StateManager.INSTALL

        # Get a list of package names from given args.
        # It may include a path to local package, a path to remote package
        # or just a package name; following crypted code will remove
        # remote paths, appends package name as is and uses the pisi.api
        # to get package name from given local package path.
        #
        # Example:
        # input : ['/tmp/ax-2.3-1.pisi', 'http://pardus.org.tr/tt-2.3.pisi', 'yali']
        # output: ['ax', 'yali']
        _pkgs = map(lambda x: pisi.api.info_file(x)[0].package.name \
                        if x.endswith('.pisi') \
                        else x, filter(lambda x: '://' not in x,
                                        get_real_paths(self.state._selected_packages)))

        _pkgs = filter(lambda x: self.iface.pdb.has_package(x), _pkgs)

        extras = self.state.iface.getExtras(_pkgs, self.state.state)
        if extras:
            self.state._selected_packages.extend(extras)

        self.model = PackageModel(self)
        self.model.setCheckable(False)

        proxy = PackageProxy(self)
        proxy.setSourceModel(self.model)

        self.packageList.setModel(proxy)
        self.packageList.setPackages(packages)
        self.packageList.selectAll(packages)
        self.packageList.setItemDelegate(
            PackageDelegate(self, self, showDetailsButton=False))
        self.packageList.setColumnWidth(0, 32)
        self.packageList.hideSelectAll()

        self.operation = OperationManager(self.state)
        self.progressDialog = ProgressDialog(self.state, self)
        self.summaryDialog = SummaryDialog()

        self.connectOperationSignals()

        self.button_install.clicked.connect(self.installPackages)
        self.button_install.setIcon(KIcon(("list-add", "add")))

        self.button_cancel.clicked.connect(self.actionCancelled)
        self.button_cancel.setIcon(KIcon("cancel"))

        self.rejected.connect(self.actionCancelled)
Exemple #23
0
    def __init__(self, app = None, packages = [], hide_summary = False):
        QDialog.__init__(self, None)
        self.setupUi(self)

        self.hide_summary = hide_summary
        self.state = StateManager(self)
        self.iface = self.state.iface
        self.state._selected_packages = packages
        self._packages = packages[:]
        self._started = False

        self._postexceptions = [lambda: sys.exit(1)]

        # Check if another pisi instance already running
        if isPisiRunning():
            self.exceptionCaught("ALREADY RUNNING", block = True)

        # Check given package names available in repositories
        if not any(package.endswith('.pisi') for package in packages):
            available_packages = self.state.packages()
            for package in packages:
                if package not in available_packages:
                    self.exceptionCaught('HTTP Error 404', package, block = True)

        # Check if local/remote packages mixed with repo packages
        # which pisi does not support to handle these at the same time
        else:
            if not all(package.endswith('.pisi') for package in packages):
                self.exceptionCaught('MIXING PACKAGES', block = True)

            # Check given local packages if exists
            for package in get_real_paths(packages):
                if '://' not in package and package.endswith('.pisi'):
                    if not os.path.exists(package):
                        self.exceptionCaught('FILE NOT EXISTS', package, block = True)

        self.state.state = StateManager.INSTALL

        # Get a list of package names from given args.
        # It may include a path to local package, a path to remote package
        # or just a package name; following crypted code will remove
        # remote paths, appends package name as is and uses the pisi.api
        # to get package name from given local package path.
        #
        # Example:
        # input : ['/tmp/ax-2.3-1.pisi', 'http://pardus.org.tr/tt-2.3.pisi', 'yali']
        # output: ['ax', 'yali']
        _pkgs = map(lambda x: pisi.api.info_file(x)[0].package.name \
                        if x.endswith('.pisi') \
                        else x, filter(lambda x: '://' not in x,
                                        get_real_paths(self.state._selected_packages)))

        _pkgs = filter(lambda x: self.iface.pdb.has_package(x), _pkgs)

        extras = self.state.iface.getExtras(_pkgs, self.state.state)
        if extras:
            self.state._selected_packages.extend(extras)

        self.model = PackageModel(self)
        self.model.setCheckable(False)

        proxy = PackageProxy(self)
        proxy.setSourceModel(self.model)

        self.packageList.setModel(proxy)
        self.packageList.setPackages(packages)
        self.packageList.selectAll(packages)
        self.packageList.setItemDelegate(PackageDelegate(self, self, showDetailsButton=False))
        self.packageList.setColumnWidth(0, 32)
        self.packageList.hideSelectAll()

        self.operation = OperationManager(self.state)
        self.progressDialog = ProgressDialog(self.state, self)
        self.summaryDialog = SummaryDialog()

        self.connectOperationSignals()

        self.button_install.clicked.connect(self.installPackages)
        self.button_install.setIcon(KIcon(("list-add", "add")))

        self.button_cancel.clicked.connect(self.actionCancelled)
        self.button_cancel.setIcon(KIcon("cancel"))

        self.rejected.connect(self.actionCancelled)
Exemple #24
0
    def __init__(self, vtk_filename=None, vtk_data=None):
        """
        Initiate Viwer

        Parameters
        ----------
        vtk_filename : str
            Input VTK filename
        """

        QDialog.__init__(self)
        self.initUI()

        ren = vtk.vtkRenderer()
        self.vtkWidget.GetRenderWindow().AddRenderer(ren)
        iren = self.vtkWidget.GetRenderWindow().GetInteractor()

        if vtk_filename is not None:
            # VTK file
            reader = vtk.vtkUnstructuredGridReader()
            reader.SetFileName(vtk_filename)
            reader.Update()
            vtkdata = reader.GetOutput()

        if vtk_data is not None:
            vtkdata = vtk_data

        # VTK surface
        surface = vtk.vtkDataSetSurfaceFilter()
        surface.SetInputData(vtkdata)
        # surface.SetInput(vtkdata)
        surface.Update()

        mapper = vtk.vtkDataSetMapper()
        mapper.SetInputData(surface.GetOutput())

        actor = vtk.vtkActor()
        actor.SetMapper(mapper)
        # actor.GetProperty().EdgeVisibilityOff()
        actor.GetProperty().SetEdgeColor(1, 0.0, 1)
        actor.GetProperty().SetDiffuseColor(1, 0.0, 1.0)
        actor.GetProperty().SetAmbientColor(1, 0.0, 1)
        actor.GetProperty().SetLineWidth(0.1)
        # import pdb; pdb.set_trace()
        # actor.GetProperty().SetColor(1, 0, 1)
        actor.GetProperty().SetOpacity(0.3)

        ren.AddActor(actor)

        # annot. cube
        axesActor = vtk.vtkAnnotatedCubeActor()
        axesActor.SetXPlusFaceText('R')
        axesActor.SetXMinusFaceText('L')
        axesActor.SetYMinusFaceText('H')
        axesActor.SetYPlusFaceText('F')
        axesActor.SetZMinusFaceText('A')
        axesActor.SetZPlusFaceText('P')
        axesActor.GetTextEdgesProperty().SetColor(1, 0, 0)
        axesActor.GetCubeProperty().SetColor(0, 0, 1)
        self.axes = vtk.vtkOrientationMarkerWidget()
        self.axes.SetOrientationMarker(axesActor)
        self.axes.SetInteractor(iren)
        self.axes.EnabledOn()
        self.axes.InteractiveOn()

        ren.SetBackground(0.5, 0.5, 0.5)
        ren.ResetCamera()
        iren.Initialize()