コード例 #1
0
ファイル: dialogs.py プロジェクト: scottwernervt/clipmanager
    def save(self):
        """Save and sync settings and return to main window.
        """
        settings.set_global_hot_key(self.key_combo_edit.text())
        settings.set_lines_to_display(self.line_count_spin.value())
        settings.set_word_wrap(self.word_wrap.isChecked())
        settings.set_send_paste(self.paste_check.isChecked())
        settings.set_exclude(self.exclude_list.text())

        # Get data integer from combo box string
        index = self.open_at_pos_combo.currentIndex()
        userdata = self.open_at_pos_combo.itemData(index)
        settings.set_open_window_at(userdata)
        
        settings.sync()
        self.done(True)
コード例 #2
0
    def clean_up(self):
        """Perform actions before exiting the application.

        Following actions are performed before exit: unbind global hot key, 
        save window position and size, submit all changes to model, and close 
        database connection.
        """
        logging.debug('Unbinding global hot key.')
        self.key_binder.unbind(settings.get_global_hot_key())

        logging.debug('Saving window size and position.')
        settings.set_window_pos(self.pos())
        settings.set_window_size(self.size())
        settings.sync()

        logging.debug('Submitting changes to model.')
        self.main_widget.model_main.submitAll()
        
        logging.debug('Closing model.')
        self.db.close()