def allow_equation_change(self, response: QAbstractButton):
        """Allow Equation Change"""
        # selected: QItemSelection = self.state_data['selected']
        deselected: QItemSelection = self.state_data['deselected']
        dirty_data = self.state_data['dirty_data']

        if response.text() == 'Discard':
            print('Ok')
            self.refresh_equation_details()
        elif response.text() == 'Save':
            d_rcd = deselected.indexes()
            ind = d_rcd[0].row()
            deselected_eqn = self.eq.selected_data_records[ind]

            new_dd: dict = dirty_data['new']

            eq_id = deselected_eqn.Index
            self.eq.update(an_id=eq_id, data=new_dd, verbose=True)
            if 'name' in new_dd.keys():
                item = self.equation_listbox.item(ind)
                item.setText(new_dd['name'])

            dirty_data = dict(new=None, old=None)
            self.state_data.update(dirty_data=dirty_data)
            # response.close()
            self.reset_selected_equation_data()
            self.refresh_equation_details()
示例#2
0
def button_make_naked(
        but: QtWidgets.QAbstractButton) -> QtWidgets.QAbstractButton:
    ''' Just applied a bunch of things to a button to "make it naked"
    which is the look we use for the lookup results and various other odds and
    ends. Returns the button passed to it. '''
    but.setStyleSheet(naked_button_style())
    but.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
    return but
示例#3
0
 def __init__(self,
              parent,
              stripeCount=3,
              stripeThikness=3,
              color=16777215):
     QAbstractButton.__init__(self, parent)
     self.stripeCount = stripeCount
     self.stripeThikness = stripeThikness
     self.stripeColor = QColor.fromRgb(color)
示例#4
0
 def __init__(self, parent=None, width=42, height=16, isOn=False):
     self.width = width
     self.height = height
     QAbstractButton.__init__(self, parent=parent)
     self.dPtr = SwitchPrivate(self, isOn=isOn)
     self.setCheckable(True)
     self.setChecked(True)
     self.clicked.connect(self.dPtr.animate)
     self.setFixedSize(self.width, self.height)
    def __init__(self, parent=None):
        QAbstractButton.__init__(self, parent)

        self.setMinimumSize(24, 24)
        self.setCheckable(True)

        # Green
        self.on_color_1 = QColor(0, 255, 0)
        self.on_color_2 = QColor(0, 192, 0)
        self.off_color_1 = QColor(0, 28, 0)
        self.off_color_2 = QColor(0, 128, 0)
示例#6
0
    def __init__(self, parent=None):
        QAbstractButton.__init__(self, parent)

        self.setMinimumSize(8, 8)
        self.setCheckable(True)
        # self.setChecked(True)

        self.ledTimeout = 75  # msec

        # Green
        self.on_color_1 = QColor(0, 255, 0)
        self.on_color_2 = QColor(0, 192, 0)
        self.off_color_1 = QColor(0, 28, 0)
        self.off_color_2 = QColor(0, 128, 0)
 def __init__(self, name, partly_disabled=True,
              disable_fancy=False, is_checkable=True):
     QAbstractButton.__init__(self)
     self.partly_disabled = partly_disabled
     self.fancy = not disable_fancy
     self.setMouseTracking(1)
     self.setText(name)
     if is_checkable:
         self.setCheckable(True)
     #if not self.fancy:
     #    self.setAutoRaise(True)
     self.hover_state = False
     self.orig_size = self.geometry()
     self.installEventFilter(self)
示例#8
0
    def __init__(self, size, direction, parent=None):
        QAbstractButton.__init__(self, parent)

        self.size = size
        self.direction = direction

        self.setMinimumSize(24, 24)
        self.setCheckable(True)
        self.setFixedWidth(size)
        self.setFixedHeight(size)

        # Green
        self.on_color_1 = QColor(0, 255, 0)
        self.on_color_2 = QColor(0, 192, 0)
        self.off_color_1 = QColor(0, 28, 0)
        self.off_color_2 = QColor(0, 128, 0)
示例#9
0
    def view_rendering(self):
        """
        Event to launch the rendering windows and all build -check the
        swarm, the source control used... and more.
        :return:
        """
        lvl_rendering = []
        submit_state = False

        for key, value in self.checkBoxLevels.items():
            btn = self.checkBoxLevels[key]
            name = btn.text()
            if QAbstractButton.isChecked(btn):
                lvl_rendering.append(name)

        if len(lvl_rendering) == 0:
            message = 'No level selected !'
            popup_msg(self, 'information', 'Error', message)

        else:
            message = 'Launch the rendering ?'
            reply = popup_msg(self, 'question', 'Rendering', message)
            lvl_rendering.sort()

            if reply == QMessageBox.Yes:
                machines = self.checkBoxMachines
                swarm_setup(QAbstractButton.isChecked(machines))
                if QAbstractButton.isChecked(self.checkBoxSubmit):
                    submit_state = True

                dial_rendering = DialRendering(self,
                                               lvl_list=lvl_rendering,
                                               csv=self.scv_data,
                                               submit=submit_state)
                dial_rendering.show()
                rsp = dial_rendering.exec_()

                if rsp == QtWidgets.QDialog.Accepted:
                    print('Rendering Validate')
                    swarm_setup(False)
                    message = 'Level Build'

            else:
                message = 'Rendering abort.'

        self.statusbar.showMessage(message)
示例#10
0
 def __init__(self, parent=None):
     QAbstractButton.__init__(self, parent=parent)
     self.dPtr = SwitchPrivate(self)
     self.setCheckable(True)
     self.clicked.connect(self.dPtr.animate)
示例#11
0
 def leaveEvent(self, event):
     if self.isEnabled():
         self.update()
     QAbstractButton.leaveEvent(self, event)
示例#12
0
 def enterEvent(self, event):
     if self.isEnabled():
         self.update()
     QAbstractButton.enterEvent(self, event)
示例#13
0
 def __init__(self, titlebar):
     QAbstractButton.__init__(self, titlebar)
     self.setFocusPolicy(Qt.NoFocus)
示例#14
0
 def clicked_hook(button: QAbstractButton):
     if button.foregroundRole() == QDialogButtonBox.ApplyRole:
         self.lslot_apply_clicked()
示例#15
0
 def set_checked(self, target: QAbstractButton, key: str) -> None:
     checked = self._options[key] in (True, "true", "True")
     target.setChecked(checked)
示例#16
0
 def __init__(self, pixmap, parent=None):
     QAbstractButton.__init__(self, parent)
     self.pixmap = pixmap
示例#17
0
文件: selection.py 项目: mjr129/groot
def show_selection_menu( control: QAbstractButton,
                         default: object,
                         mode: type = object,
                         ) -> object:
    """
    Shows the selection menu.
    
    :param control:     Button to drop the menu down from. 
    :param default:     Currently selected item
    :param mode:        What we are capable of selecting (as a `type`).
    :return:            The selection made. This will have already been committed to `actions` if `actions` is a `GuiActions` object. 
    """
    model = groot.global_view.current_model()
    
    selection = default
    
    alive = []
    
    root = QMenu()
    root.setTitle( "Make selection" )
    
    # Sequences
    _add_submenu( "Genes", mode, alive, model.genes, root, selection, resources.black_gene )
    
    # Edges
    _add_submenu( "Edges", mode, alive, model.genes, root, selection, resources.black_edge, expand_functions = [groot.Gene.iter_edges] )
    
    # Components
    _add_submenu( "Components", mode, alive, model.components, root, selection, resources.black_major )
    
    # Components - FASTA (unaligned)
    _add_submenu( "Component FASTA (unaligned)", mode, alive, (x.named_unaligned_fasta for x in model.components), root, selection, resources.black_alignment )
    
    # Domains
    _add_submenu( "Domains", mode, alive, model.genes, root, selection, resources.black_domain, expand_functions = [groot.Gene.iter_userdomains] )
    
    # Components - FASTA (aligned)
    _add_submenu( "Component FASTA (aligned)", mode, alive, (x.named_aligned_fasta for x in model.components), root, selection, resources.black_alignment )
    
    # Components - trees (rooted)
    _add_submenu( "Component trees (rooted)", mode, alive, (x.named_tree for x in model.components), root, selection, resources.black_tree )
    
    # Components - trees (unrooted)
    _add_submenu( "Component trees (unrooted)", mode, alive, (x.named_tree_unrooted for x in model.components), root, selection, resources.black_tree )
    
    # Fusions
    _add_submenu( "Fusion events", mode, alive, model.fusions, root, selection, resources.black_fusion )
    
    # Fusion formations
    _add_submenu( "Fusion formations", mode, alive, model.fusions, root, selection, resources.black_fusion, expand_functions = [lambda x: x.formations] )
    
    # Fusion points
    _add_submenu( "Fusion points", mode, alive, model.fusions, root, selection, resources.black_fusion, expand_functions = [lambda x: x.formations, lambda x: x.points] )
    
    #  Splits
    _add_submenu( "Splits", mode, alive, model.splits, root, selection, resources.black_split, create_index = True )
    
    # Consensus
    _add_submenu( "Consensus", mode, alive, model.consensus, root, selection, resources.black_consensus, create_index = True )
    
    # Subsets
    _add_submenu( "Subsets", mode, alive, model.subsets, root, selection, resources.black_subset )
    
    # Pregraphs
    _add_submenu( "Pregraphs", mode, alive, model.iter_pregraphs(), root, selection, resources.black_pregraph )
    
    # Subgraphs
    _add_submenu( "Supertrees", mode, alive, model.subgraphs, root, selection, resources.black_subgraph )
    
    # NRFG - clean
    _add_submenu( "Fusion graphs", mode, alive, (model.fusion_graph_unclean, model.fusion_graph_clean), root, selection, resources.black_nrfg )
    
    # NRFG - report
    _add_submenu( "Reports", mode, alive, (model.report,), root, selection, resources.black_check )
    
    # Usergraphs
    _add_submenu( "User graphs", mode, alive, model.user_graphs, root, selection, resources.black_nrfg )
    
    # Usergraphs
    _add_submenu( "User reports", mode, alive, model.user_reports, root, selection, resources.black_check )
    
    # Special
    if len( root.actions() ) == 0:
        act = QAction()
        act.setText( "List is empty" )
        act.setEnabled( False )
        act.tag = None
        alive.append( act )
        root.addAction( act )
    elif len( root.actions() ) == 1:
        root = root.actions()[0].menu()
    
    # Show menu
    orig = control.text()
    control.setText( root.title() )
    root.setStyleSheet( _MENU_CSS )
    selected = root.exec_( control.mapToGlobal( QPoint( 0, control.height() ) ) )
    control.setText( orig )
    
    if selected is None:
        return None
    
    return selected.tag
示例#18
0
 def _btnclick(self, btn: QAbstractButton):
     self.out = btn.text().lstrip("&").replace(' ', '').lower()
示例#19
0
 def _click(self, button: W.QAbstractButton):
     button.click()
示例#20
0
def _(btn: W.QAbstractButton):
    return btn.text().replace("&", "")