def create_textedit(self): """ Creates a QTextEdit with a default formatting :return: QTextEdit """ edit = QTextEdit() grid_edit(self.app, edit) return edit
def create_lineedit(self): """ Creates a QLineEdit with a default formatting :return: QLineEdit """ edit = QLineEdit() grid_edit(self.app, edit) return edit
def create_textedit(self): """ Creates a QTextEdit with a default formatting Args: Returns: edit (QTextEdit): Text edit widget. """ edit = QTextEdit() grid_edit(self.app, edit) return edit
def create_lineedit(self): """ Creates a QLineEdit with a default formatting Args: Returns: edit (QLineEdit): Line edit widget. """ edit = QLineEdit() grid_edit(self.app, edit) return edit
def create_lineedit(self, label, fill): """ Creates and formats a QLabel and QlineEdit pair :param label: String. :param fill: String :return: QLabel, QLineEdit """ lbl = self.create_label(label) edit = QLineEdit(fill) grid_edit(self.app, edit) return lbl, edit
def create_textedit(self, label, fill): """ Creates and formats a QLabel and QTextEdit pair :param label: String. :param fill: String. :return: QLabel, QTextEdit """ lbl = self.create_label(label) edit = QTextEdit() edit.setPlainText(fill) grid_edit(self.app, edit) return lbl, edit
def create_edit(self, label): """ Creates a QLabel and QTextEdit pair. Args: label: Name of field to be associated to the text edit. Returns: lbl (QLabel): Formatted label widget. edit (QLineEdit): Formatted text edit widget. """ # Create Label lbl = QLabel(label) lbl.setFont(label_font(self.app)) lbl.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred) # Create LineEdit edit = QTextEdit() grid_edit(self.app, edit) return lbl, edit
def description_vbox(self): """ Creates a Vertical box layout containing the description label and edit button and a textedit field :return: QVBoxLayout """ # Create the Description Label lbl = self.create_label('Description') lbl.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) # Create Edit Button edit_btn = QPushButton() edit_btn.setIcon( QIcon(os.path.abspath(__file__ + '/../..' + '/img/Pencil-52.png'))) edit_btn.setMaximumWidth(self.geometry().width() / 50) edit_btn.setMaximumHeight(self.geometry().width() / 50) checkable_button(self.app, edit_btn) # Create TextEdit description = self.project_info['description'] text_edit = QTextEdit() if description is not None and description != '': text_edit.setText(description) grid_edit(self.app, text_edit) text_edit.setEnabled(False) self.desc_wid = text_edit # Add an action to the edit button edit_btn.clicked[bool].connect(lambda: self.on_edit_pressed(text_edit)) # Create a horizontal layout for the label and edit button hbox = QHBoxLayout() hbox.addWidget(lbl) hbox.addWidget(edit_btn) # Create a Vertical layout to hold the label layout and the edit field vbox = QVBoxLayout() vbox.addLayout(hbox) vbox.addWidget(text_edit) return vbox
def create_lineedit(self, label: str): """ Creates a QLabel and QLineEdit pair. Args: label: Name of field to be associated to the line edit. Returns: lbl (QLabel): Formatted label widget. edit (QLineEdit): Formatted line edit widget. """ # Create Label lbl = QLabel(label) grid_label(self.app, lbl) # Create LineEdit edit = QLineEdit() edit.setClearButtonEnabled(True) grid_edit(self.app, edit) return lbl, edit
def info_grid(self): """ Creates a grid layout containing more details on the project :return: QGridlayout """ # Create Labels # Project ID Label id_lbl = QLabel('Project ID') grid_label(self.app, id_lbl) # Published Label pub_lbl = QLabel('Published') grid_label(self.app, pub_lbl) # Collaborators Label col_lbl = QLabel('Collaborators') grid_label(self.app, col_lbl) # Funding Label fund_lbl = QLabel('Funding') grid_label(self.app, fund_lbl) # Group Label group_lbl = QLabel('Group') grid_label(self.app, group_lbl) # Storage Label stor_lbl = QLabel('Storage') grid_label(self.app, stor_lbl) # Create Edit Fields # Project ID Field id_field = QLabel() grid_edit(self.app, id_field) id_field.setText(str(self.project_info['id'])) # Published Field published_date = self.project_info['published_date'] if published_date is None: published_date = 'Private' pub_field = QLabel() pub_field.setText(published_date) # Collaborators Field collaborators = self.project_info['collaborators'] col_field = QButtonField(parent=self) if collaborators is not None: for col in collaborators: name = col['name'] user_id = col['user_id'] tag = "{}: {}".format(name, user_id) col_field.add_tag(tag) self.col_wid = col_field # Funding Field funding = self.project_info['funding'] funding_field = QButtonField(parent=self) if funding != '': for funder in funding.split(':_:'): if funder != '': funding_field.add_tag(funder) self.fund_wid = funding_field # Group Field group_id = self.project_info['group_id'] group_field = QLabel() grid_label(self.app, group_field) if group_id != 0: group_field.setText(str(group_id)) else: group_field.setText('Private Project') # Storage Field quota_text = self.get_quota_percentage() storage_field = QLabel(quota_text) grid_label(self.app, storage_field) # Create and Populate grid grid = QGridLayout() grid.addWidget(id_lbl, 0, 0) grid.addWidget(id_field, 0, 1) grid.addWidget(pub_lbl, 1, 0) grid.addWidget(pub_field, 1, 1) grid.addWidget(col_lbl, 2, 0) grid.addWidget(col_field, 2, 1, 1, 3) grid.addWidget(fund_lbl, 3, 0) grid.addWidget(funding_field, 3, 1, 1, 3) grid.addWidget(group_lbl, 0, 2) grid.addWidget(group_lbl, 0, 3) grid.addWidget(stor_lbl, 1, 2) grid.addWidget(storage_field, 1, 3) return grid