def create_command_buttons(self): """ Create a layout containing two buttons. One to create a new object and the second to cancel. Returns: vbox (QVBoxLayout): Layout containing the create and cancel buttons. """ # Create save button sv_btn = QPushButton() press_button(self.app, sv_btn) # Format button sv_btn.setIcon( QIcon( os.path.abspath(__file__ + '/../..' + '/img/figshare_upload.png'))) sv_btn.setToolTip('Save new object.') sv_btn.setToolTipDuration(1000) sv_btn.pressed.connect(self.on_save_pressed) # Create cancel button cl_btn = QPushButton() press_button(self.app, cl_btn) # Format button cl_btn.setIcon( (QIcon(os.path.abspath(__file__ + '/../..' + '/img/exit.png')))) cl_btn.setToolTip('Exit without saving.') cl_btn.setToolTipDuration(1000) cl_btn.pressed.connect(self.on_cancel_pressed) # Create Layout vbox = QVBoxLayout() vbox.addWidget(sv_btn) vbox.addWidget(cl_btn) return vbox
def exit_button(self): """ Creates an exit button to close the article edit window without saving changes :return: QPushButton """ btn = QPushButton() btn.setIcon(QIcon(os.path.normpath(__file__ + '/../../img/exit.png'))) press_button(self.app, btn) btn.pressed.connect(self.on_exit_pressed) return btn
def headers_selection_button(self): """ Button pressed to open the headers selectionw window :return: QPushButton """ btn = QPushButton('Select Headers') press_button(self.app, btn) btn.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) btn.clicked[bool].connect(self.on_headers_set_pressed) btn.setEnabled(False) self.headers_btn = btn return self.headers_btn
def initButton(self): btn = QPushButton() btn.setIcon( QIcon(os.path.normpath(__file__ + '/../../img/Folder-48.png'))) btn.setToolTip('Select Figshare Collection for upload') btn.setToolTipDuration(2500) press_button(self.app, btn) btn.pressed.connect(self.select_collection) self.coll_button = btn return self.coll_button
def save_button(self): """ Creates a save button to push changes to Figshare :return: QPushButton """ btn = QPushButton() btn.setIcon( QIcon(os.path.normpath(__file__ + '/../../img/figshare_upload.png'))) press_button(self.app, btn) btn.pressed.connect(self.on_save_pressed) return btn
def download_article_button(self): """ Creates a QPushButton that will download the selected articles. Returns: QPushButton: Connected to the on_download_article_pressed function. """ btn = QPushButton() btn.setIcon(QIcon(os.path.normpath(__file__ + '/../../img/figshare_download.png'))) press_button(self.app, btn) btn.setToolTip('Download selected articles') btn.setToolTipDuration(1000) btn.pressed.connect(self.on_download_article_pressed) return btn
def delete_article_button(self): """ Creates a QPushButton that can be used to deleted selected articles. Returns: QPushButton Widget connected to the on_delete_article_pressed function """ btn = QPushButton() btn.setIcon(QIcon(os.path.normpath(__file__ + '/../../img/delete.png'))) press_button(self.app, btn) btn.setToolTip('Delete selected articles') btn.setToolTipDuration(1000) btn.pressed.connect(self.on_delete_article_pressed) return btn
def edit_article_button(self): """ Create a QPushButton that is used to open the article edit window for the selected articles. Returns: QPushButton Widget connected to the on_edit_article_pressed function """ btn = QPushButton() btn.setIcon(QIcon(os.path.normpath(__file__ + '/../../img/Pencil-52.png'))) press_button(self.app, btn) btn.setToolTip('Open article edit window') btn.setToolTipDuration(1000) btn.pressed.connect(self.on_edit_article_pressed) return btn
def clear_btn(self): """ QPushButton to clear the log :return: QPushButton """ btn = QPushButton() btn.setIcon(QIcon(os.path.normpath(__file__ + '/../../img/delete.png'))) press_button(self.app, btn) btn.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) btn.pressed.connect(self.clear_log) return btn
def initButton(self): btn = QPushButton() btn.setIcon( QIcon(os.path.normpath(__file__ + '/../../img/Folder-48.png'))) btn.setToolTip('Select Figshare Project for upload') btn.setToolTipDuration(2500) press_button(self.app, btn) btn.setStyleSheet("background-color: red") btn.pressed.connect(self.select_project) self.proj_button = btn return self.proj_button
def delete_btn(self): """ Creates a QPushButton that can be used to remove local articles from the list and memory :return: """ btn = QPushButton() btn.setIcon(QIcon(os.path.normpath(__file__ + '/../../img/delete.png'))) btn.setToolTip('Delete selected articles') btn.setToolTipDuration(1) press_button(self.app, btn) btn.pressed.connect(self.on_delete_pressed) return btn
def set_directory_btn(self): """ Creates a QPushButton that can be used to set the current root directory :return: QPushButton """ btn = QPushButton() btn.setIcon( QIcon(os.path.normpath(__file__ + '/../../img/Folder-48.png'))) press_button(self.app, btn) # Format button btn.setToolTip("Select local directory") btn.setToolTipDuration(1) btn.pressed.connect(self.on_set_directory_pressed) return btn
def edit_btn(self): """ Creates a QPushButton that opens the metadata edit window for the selected articles. :return: """ btn = QPushButton() btn.setIcon( QIcon(os.path.normpath(__file__ + '/../../img/Pencil-52.png'))) btn.setToolTip('Edit metadata of selected articles') btn.setToolTipDuration(1) press_button(self.app, btn) btn.pressed.connect(self.on_edit_pressed) btn.setEnabled(False) self.edit_btn = btn return self.edit_btn
def stop_upload_btn(self): """ Creates a QPushButton that will try to stop the upload process :return: """ btn = QPushButton() press_button(self.app, btn) btn.setIcon(QIcon(os.path.normpath(__file__ + '/../../img/exit.png'))) btn.setToolTip('Stop Upload') btn.setToolTipDuration(1) btn.setEnabled(False) #btn.pressed.connect(self.stop_upload) self.stop_btn = btn return self.stop_btn
def project_btn(self): """ Creates a QPushButton than can be used to add selected articles to an existing figshare project :return: """ btn = QPushButton() btn.setIcon( QIcon( os.path.normpath(__file__ + '/../../img/Insert Row Below-48.png'))) btn.setToolTip('Add selection to upload queue') btn.setToolTipDuration(1) press_button(self.app, btn) btn.pressed.connect(self.on_project_pressed) self.proj_btn = btn return self.proj_btn
def add_to_selection_btn(self): """ Creates a QPushButton that can be used to open the metadata window for the selected items in the file browser :return: QPushButton """ btn = QPushButton() btn.setIcon( QIcon( os.path.normpath(__file__ + '/../../img/Insert Row Below-48.png'))) press_button(self.app, btn) # Format button btn.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) btn.setToolTip("Add selected items to articles list") btn.setToolTipDuration(1) btn.pressed.connect(self.on_open_selection_clicked) return btn
def start_upload_btn(self): """ Creates a QPushButton that will start the upload process :return: """ btn = QPushButton() press_button(self.app, btn) btn.setIcon(QIcon(os.path.normpath(__file__ + '/../../img/figshare_upload.png'))) btn.setToolTip('Begin Upload') btn.setToolTipDuration(1) btn.setEnabled(False) btn.pressed.connect(self.start_upload) self.start_btn = btn return self.start_btn