Ejemplo n.º 1
0
 def init_notebooks(self):
     frame = QFrame()
     layout = QVBoxLayout()
     frame.setLayout(layout)
     self.ui.scrollArea.setWidget(frame)
     for notebook_struct in self.app.provider.list_notebooks():
         notebook = Notebook.from_tuple(notebook_struct)
         count = self.app.provider.get_notebook_notes_count(notebook.id)
         widget = QWidget()
         menu = QMenu(self)
         menu.addAction(self.tr('Change Name'), Slot()(partial(
             self.change_notebook, notebook=notebook,
         )))
         action = menu.addAction(self.tr('Remove Notebook'), Slot()(partial(
             self.remove_notebook, notebook=notebook,
         )))
         action.setEnabled(False)
         widget.ui = Ui_Notebook()
         widget.ui.setupUi(widget)
         widget.ui.name.setText(notebook.name)
         widget.ui.content.setText(self.tr('Containts %d notes') % count)
         widget.ui.actionBtn.setIcon(QIcon.fromTheme('gtk-properties'))
         widget.setFixedHeight(50)
         layout.addWidget(widget)
         widget.ui.actionBtn.clicked.connect(Slot()(partial(
             self.show_notebook_menu,
             menu=menu, widget=widget,
         )))