示例#1
0
    def __init__(self, dry_run=False):
        super().__init__()

        self._updater = CondaUpdater(dry_run=dry_run)
        self._updater.getStatus_done.connect(self.showStatus)
        self._updater.getStatus_done.connect(self.showOKorUpdateButton)
        self._updater.failed.connect(self.initFailureMode)
        self._updater.updateAllPkgs_done.connect(self.relaunchProc)

        style = '''
            QProgressBar {
                background-color: rgb(226,226,226);
                border: 1px solid rgb(222,222,222);
                border-radius: 2px;
                text-align: center;
            }

            QProgressBar::chunk {
                background-color: #0099FF;
                height: 15px;
                width: 1px;
            }
        '''
        self._pbar = QtGui.QProgressBar(self)
        self._pbar.setStyleSheet(style)
        self._updater.pdone.connect(self.pdone)

        self._txtbox = TextBox('')
        self._txtbox.wdg.setTextFormat(QtCore.Qt.RichText)
        self._txtbox.set_wordwrap(True)
        self._txtbox.set_openExternalLinks(True)
        self._updater.message.connect(self._txtbox.set_val)
        self._txtbox.set_val('Checking for updates...')

        self._okButton = QtGui.QPushButton("OK")
        self._okButton.setVisible(False)
        self._cancelButton = QtGui.QPushButton("Cancel")
        self._cancelButton.clicked.connect(self.close)

        hbox = QtGui.QHBoxLayout()
        hbox.addStretch(1)
        hbox.addWidget(self._okButton)
        hbox.addWidget(self._cancelButton)

        vbox = QtGui.QVBoxLayout()
        vbox.addWidget(self._txtbox, 1)
        vbox.addWidget(self._pbar)
        vbox.addLayout(hbox)

        self.setLayout(vbox)

        self.setGeometry(300, 300, 400, 350)
        self.setWindowTitle('GPI Update')
        self.show()
        self.raise_()

        ExecRunnable(Runnable(self._updater.getStatus))
示例#2
0
 def __init__(self, title, parent=None):
     super(ReduceSliders, self).__init__(title, parent)
     self.sl = gpi.BasicCWFCSliders()
     self.sl.valueChanged.connect(self.valueChanged)
     # at least one button
     self.button_names = ['C/W', 'B/E', 'Slice', 'Pass']
     self.buttons = []
     cnt = 0
     wdgLayout = QtGui.QGridLayout()
     for name in self.button_names:
         newbutton = QtGui.QPushButton(name)
         newbutton.setCheckable(True)
         newbutton.setAutoExclusive(True)
         self.buttons.append(newbutton)
         newbutton.clicked.connect(self.findValue)
         newbutton.clicked.connect(self.valueChanged)
         wdgLayout.addWidget(newbutton, 0, cnt, 1, 1)
         cnt += 1
     # layout
     wdgLayout.addWidget(self.sl, 1, 0, 1, 4)
     wdgLayout.setVerticalSpacing(0)
     wdgLayout.setSpacing(0)
     self.setLayout(wdgLayout)
     # default
     self.set_min(1)
     self._selection = 3  # pass is default
     self.buttons[self._selection].setChecked(True)
     self.sl.set_allvisible(False)
示例#3
0
 def add_include_gz_pushbutton(self):
     """Adding PushButton toggle for Gz along with Rf."""
     self.include_gz_pushbutton = QtGui.QPushButton('Add Gz event with Rf')
     self.include_gz_pushbutton.setCheckable(True)
     self.include_gz_pushbutton.setVisible(False)
     self.include_gz_pushbutton.clicked.connect(self.button_clicked)
     self.include_gz_pushbutton.clicked.connect(self.valueChanged)
     # Syntax: addWidget(widget, row, col, rowSpan, colSpan)
     self.wdg_layout.addWidget(self.include_gz_pushbutton, 12, 1, 1, 6)
示例#4
0
 def add_include_in_loop_pushbutton(self):
     """Adding PushButton to toggle Event being included/excluded in loop."""
     self.include_in_loop_pushbutton = QtGui.QPushButton(
         'Add event in loop')
     self.include_in_loop_pushbutton.setCheckable(True)
     self.include_in_loop_pushbutton.setChecked(True)
     self.include_in_loop_pushbutton.setVisible(False)
     self.include_in_loop_pushbutton.clicked.connect(self.button_clicked)
     self.include_in_loop_pushbutton.clicked.connect(self.valueChanged)
     # Syntax: addWidget(widget, row, col, rowSpan, colSpan)
     self.wdg_layout.addWidget(self.include_in_loop_pushbutton, 11, 1, 1, 6)
示例#5
0
 def add_event_pushbuttons(self):
     """Adding PushButtons for the Events."""
     col_count = 0
     for name in self.button_names_list:
         new_button = QtGui.QPushButton(name)
         new_button.setCheckable(True)
         new_button.setAutoExclusive(True)
         new_button.clicked.connect(self.button_clicked)
         new_button.clicked.connect(self.valueChanged)
         # Syntax: addWidget(widget, row, col, rowSpan, colSpan)
         self.wdg_layout.addWidget(new_button, 0, col_count, 1, 1)
         self.buttons_list.append(new_button)
         col_count += 1
示例#6
0
    def generateNewNodeListWindow(self):
        # the New Node window
        self._list_win = QtGui.QWidget()
        self._list_win.setFixedWidth(500)
        self._new_node_list = QtGui.QListWidget(self._list_win)

        self._create_button = QtGui.QPushButton("Create Node", self._list_win)
        self._create_button.setDisabled(True)
        self._create_button.clicked.connect(self._createNewNode)
        button_layout = QtGui.QHBoxLayout()
        button_layout.addStretch(1)
        button_layout.addWidget(self._create_button)

        self._new_node_list.itemDoubleClicked.connect(self._listItemDoubleClicked)
        self._new_node_list.itemClicked.connect(self._listItemClicked)

        self._list_label = QtGui.QLabel("GPI Libraries", self._list_win)

        node_name_layout = QtGui.QHBoxLayout()
        new_node_name_label = QtGui.QLabel("Name:", self._list_win)
        self._new_node_name_field = QtGui.QLineEdit(self._list_win)
        self._new_node_name_field.setPlaceholderText("NewNodeName_GPI.py")
        self._new_node_name_field.textChanged.connect(self._newNodeNameEdited)
        node_name_layout.addWidget(new_node_name_label)
        node_name_layout.addWidget(self._new_node_name_field)

        new_node_path_label = QtGui.QLabel("Path:", self._list_win)
        self._new_node_path = ''
        self._new_node_path_field = QtGui.QLabel(NOPATH_MESSAGE, self._list_win)
        self._new_node_path_field.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed))
        path_layout = QtGui.QHBoxLayout()
        path_layout.addWidget(new_node_path_label)
        path_layout.addWidget(self._new_node_path_field)

        list_layout = QtGui.QVBoxLayout()
        list_layout.addWidget(self._list_label)
        list_layout.addWidget(self._new_node_list)
        list_layout.addLayout(node_name_layout)
        list_layout.addLayout(path_layout)
        list_layout.addLayout(button_layout)
        self._list_win.setLayout(list_layout)
示例#7
0
    def __init__(self, image_path):

        # find the limiting desktop dimension (w or h)
        pm = QtGui.QPixmap.fromImage(QtGui.QImage(image_path))
        g = QtGui.QDesktopWidget().availableGeometry()
        w = g.width()
        h = g.height()
        r = float(pm.width()) / pm.height()  # aspect ratio
        if (w <= pm.width()):
            h = int(w / r)
        if (h <= pm.height()):
            w = int(h * r)

        # the splash is almost useless below 500pts
        if w < 500:
            w = 500

        # resize the image based on new width
        if (w != g.width()) or (h != g.height()):
            pm = pm.scaledToWidth(int(w * 0.8),
                                  mode=QtCore.Qt.SmoothTransformation)

        # scale subsequent parameters based on new image width
        iw = pm.width()
        ih = pm.height()

        super(Splash, self).__init__(pm)

        # use a timer instead of the EULA
        self._timer = QtCore.QTimer()
        self._timer.timeout.connect(self.terms_accepted.emit)
        self._timer.setSingleShot(True)
        if not INCLUDE_EULA:
            self._timer.start(2000)

        panel = QtGui.QWidget()
        pal = QtGui.QPalette(QtGui.QColor(255, 255, 255))  # white
        panel.setAutoFillBackground(True)
        panel.setPalette(pal)

        lic = '''
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        '''
        self.lic = QtGui.QTextEdit(lic)
        self.lic.setReadOnly(True)

        button_title = 'Agree'
        self.wdg1 = QtGui.QPushButton(button_title, self)
        self.wdg1.setCheckable(False)
        self.wdg1.setFixedSize(int(iw * 0.2), int(iw * 0.05))
        self.wdg1.clicked[bool].connect(self.accept)

        button_title = 'Quit'
        self.wdg2 = QtGui.QPushButton(button_title, self)
        self.wdg2.setCheckable(False)
        self.wdg2.setFixedSize(int(iw * 0.2), int(iw * 0.05))
        self.wdg2.clicked[bool].connect(self.reject)

        buf = 'Click Agree to start GPI or Quit to exit.'
        new_fw = iw * 0.45
        for fw_i in range(20, 0, -1):
            f = QtGui.QFont('gill sans', fw_i)
            fm = QtGui.QFontMetricsF(f)
            cfw = fm.width(buf)
            if cfw < new_fw:
                break
        f = QtGui.QFont('gill sans', fw_i)

        self.prompt = QtGui.QLabel(buf)
        self.prompt.setAlignment(QtCore.Qt.AlignCenter)
        self.prompt.setFont(f)

        wdgLayout = QtGui.QHBoxLayout()
        #wdgLayout.setContentsMargins(0, 0, 0, 0)  # no spaces around this item
        #wdgLayout.setSpacing(0)
        #wdgLayout.addSpacerItem(QtGui.QSpacerItem(iw/2,1,hPolicy=QtGui.QSizePolicy.Minimum))
        wdgLayout.addWidget(self.prompt)
        wdgLayout.addWidget(self.wdg1)
        #wdgLayout.addSpacerItem(QtGui.QSpacerItem(int(iw*0.01),1,hPolicy=QtGui.QSizePolicy.Minimum))
        wdgLayout.addWidget(self.wdg2)
        #wdgLayout.addSpacerItem(QtGui.QSpacerItem(1,1,hPolicy=QtGui.QSizePolicy.MinimumExpanding))

        # a small panel
        vbox_p = QtGui.QVBoxLayout()
        vbox_p.setContentsMargins(10, 10, 10, 10)
        vbox_p.setSpacing(10)
        vbox_p.addWidget(self.lic)
        vbox_p.addLayout(wdgLayout)
        panel.setLayout(vbox_p)

        # white space | panel
        vbox = QtGui.QVBoxLayout()
        #vbox.setContentsMargins(0, 0, 0, int(iw*0.02))  # no spaces around this item
        vbox.setContentsMargins(0, 0, 0, 0)  # no spaces around this item
        vbox.setSpacing(0)

        vbox.addSpacerItem(
            QtGui.QSpacerItem(iw, (1 - 0.28) * ih,
                              hPolicy=QtGui.QSizePolicy.Minimum,
                              vPolicy=QtGui.QSizePolicy.Minimum))

        #vbox.addWidget(self.lic)
        vbox.addWidget(panel)
        #vbox.addLayout(wdgLayout)

        if INCLUDE_EULA:
            self.setLayout(vbox)

        self._accept = False
示例#8
0
    def __init__(self, node):
        super(NodeAPI, self).__init__()

        #self.setToolTip("Double Click to Show/Hide each Widget")
        self.node = node

        self.label = ''
        self._detailLabel = ''
        self._docText = None
        self.parmList = []  # deprecated, since dicts have direct name lookup
        self.parmDict = {}  # mirror parmList for now
        self.parmSettings = {}  # for buffering wdg parms before copying to a PROCESS
        self.shdmDict = {} # for storing base addresses

        # grid for module widgets
        self.layout = QtGui.QGridLayout()

        # this must exist before user-widgets are added so that they can get
        # node label updates
        self.wdglabel = QtGui.QLineEdit(self.label)

        # allow logger to be used in initUI()
        self.log = manager.getLogger(node.getModuleName())

        try:
            self._initUI_ret = self.initUI()
        except:
            log.error('initUI() failed. '+str(node.item.fullpath)+'\n'+str(traceback.format_exc()))
            self._initUI_ret = -1  # error

        # make a label box with the unique id
        labelGroup = HidableGroupBox("Node Label")
        labelLayout = QtGui.QGridLayout()
        self.wdglabel.textChanged.connect(self.setLabel)
        labelLayout.addWidget(self.wdglabel, 0, 1)
        labelGroup.setLayout(labelLayout)
        self.layout.addWidget(labelGroup, len(self.parmList) + 1, 0)
        labelGroup.set_collapsed(True)
        labelGroup.setToolTip("Displays the Label on the Canvas (Double Click)")

        # make an about box with the unique id
        self.aboutGroup = HidableGroupBox("About")
        aboutLayout = QtGui.QGridLayout()
        self.about_button = QtGui.QPushButton("Open Node &Documentation")
        self.about_button.clicked.connect(self.openNodeDocumentation)
        aboutLayout.addWidget(self.about_button, 0, 1)
        self.aboutGroup.setLayout(aboutLayout)
        self.layout.addWidget(self.aboutGroup, len(self.parmList) + 2, 0)
        self.aboutGroup.set_collapsed(True)
        self.aboutGroup.setToolTip("Node Documentation (docstring + autodocs, Double Click)")

        # window (just a QTextEdit) that will show documentation text
        self.doc_text_win = QtGui.QTextEdit()
        self.doc_text_win.setPlainText(self.generateHelpText())
        self.doc_text_win.setReadOnly(True)
        doc_text_font = QtGui.QFont("Monospace", 14)
        self.doc_text_win.setFont(doc_text_font)
        self.doc_text_win.setLineWrapMode(QtGui.QTextEdit.NoWrap)
        self.doc_text_win.setWindowTitle(node.getModuleName() + " Documentation")

        hbox = QtGui.QHBoxLayout()
        self._statusbar_sys = QtGui.QLabel('')
        self._statusbar_usr = QtGui.QLabel('')
        hbox.addWidget(self._statusbar_sys)
        hbox.addWidget(self._statusbar_usr, 0, (QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter))

        # window resize grip
        self._grip = QtGui.QSizeGrip(self)
        hbox.addWidget(self._grip)

        self.layout.addLayout(hbox, len(self.parmList) + 3, 0)
        self.layout.setRowStretch(len(self.parmList) + 3, 0)

        # uid display
        # uid   = QtGui.QLabel("uid: "+str(self.node.getID()))
        # uid.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
        # self.layout.addWidget(uid,len(self.parmList)+2,0)

        # instantiate the layout
        self.setLayout(self.layout)

        # run through all widget titles since each widget parent is now set.
        for parm in self.parmList:
            parm.setDispTitle()

        # instantiate the layout
        # self.setGeometry(50, 50, 300, 40)

        self.setTitle(node.getModuleName())

        self._starttime = 0
        self._startline = 0
示例#9
0
    def __init__(self):
        super(MainCanvas, self).__init__()

        # useful for tracking number of file handles
        #self._report = QtCore.QTimer()
        #self._report.setInterval(1000)
        #self._report.timeout.connect(Specs.numOpenFiles)
        #self._report.start()

        # A statusbar widget
        self._statusLabel = QtGui.QLabel()

        # for copying between canvases
        self._copybuffer = None

        # TAB WIDGET
        self.tabs = QtGui.QTabWidget()
        self.tabs.setTabsClosable(True)
        self.tabs.setTabPosition(QtGui.QTabWidget.North)
        self.tabs.tabCloseRequested.connect(self.closeCanvasTab)
        self.tabs.currentChanged.connect(self.tabChange)
        self.tabs.setMovable(True)
        self.setCentralWidget(self.tabs)
        self.tabs.show()

        # ADD TAB BUTTON
        self.addbutton = QtGui.QPushButton('+')
        self.addbutton.clicked[bool].connect(self.addNewCanvasTab)
        self.tabs.setCornerWidget(self.addbutton)

        # ADD CANVAS TABS
        self._canvasCnt = 1
        newGraph = GraphWidget("Canvas 1", self)
        newGraph._curState.connect(self.updateCanvasStatus)
        self.tabs.addTab(newGraph, "Canvas 1")

        # possible names for this project
        if (time.localtime().tm_mon == 4) and (time.localtime().tm_mday == 1):
            titleList = []
            titleList += ['Master Control Processor (MCP)']
            titleList += ['Code Flow GPI']
            titleList += ['Code Shepherd']
            titleList += ['Source Flow']
            titleList += ['Algorithm Processing Network (APN)']
            titleList += ['Visual Algorithm Processor (VAP)']
            titleList += ['Data-Analysing Robot Youth Lifeform (D.A.R.Y.L.)']
            titleList += ['Heuristically-programmed ALgorithmic computer (H.A.L.)']
            titleList += ['Johnny Five']
            titleList += ['Visual Programming Paradigm (Vpp)']
            titleList += ['Graphical Prototyping Platform (Gpp)']
            titleList += ['Node Commander (GPI)']
            titleList += ['Algorithm Dominator (GPI)']
            titleList += ['ProtoWizard (GPI)']
            titleList += ['Algorithm Maestro (GPI)']
            titleList += ['Node Guru (GPI)']
            titleList += ['Process Master (GPI)']
            titleList += ['Prototype Expert (GPI)']
            titleList += ['Algorithm Assemblage (GPI)']
            titleList += ['High Performance Algorithm Collider (GPI)']
            titleList += ['Cluster Flow (GPI)']
            titleList += ['Mothra (GPI)']
            titleList += ['Assimilator (GPI)']
            titleList += ['Algorithm Integrator (GPI)']
            titleList += ['Method Mapper (GPI)']
            titleList += ['Method Master (GPI)']
            titleList += ['Vfunc (Visual Functor)']

            from random import choice
            self.setWindowTitle(choice(titleList))

        else:
            self.setWindowTitle('Graphical Programming Interface (GPI)')

        # system tray icon (this actually works in Ubuntu)
        from .defines import ICON_PATH
        self._gpiIcon = QtGui.QIcon(ICON_PATH)
        self.setWindowIcon(self._gpiIcon)
        #self._trayicon = QtGui.QSystemTrayIcon(self._gpiIcon, parent=self)
        #self._trayicon.show()

        # don't bother with the menus if the gui is not up
        if not Commands.noGUI():
            self.createMenus()

            best_style = None
            if 'Macintosh (aqua)' in list(QtGui.QStyleFactory.keys()):
                log.debug("Choosing Mac aqua style.")
                best_style = 'Macintosh (aqua)'
            elif 'Cleanlooks' in list(QtGui.QStyleFactory.keys()):
                log.debug("Choosing Cleanlooks style.")
                best_style = 'Cleanlooks'
            if best_style:
                QtGui.QApplication.setStyle(QtGui.QStyleFactory.create(best_style))
                QtGui.QApplication.setPalette(
                    QtGui.QApplication.style().standardPalette())

            # Status Bar
            message = "A context menu is available by right-clicking"
            self.statusBar().addPermanentWidget(self._statusLabel)
            self.statusBar().showMessage(message)

            self.updateCanvasStatus()