コード例 #1
0
ファイル: forum_gui_module.py プロジェクト: fuinha/openmolar1
def forumDeleteItem(om_gui):
    '''
    delete a forum posting
    '''
    items = om_gui.ui.forum_treeWidget.selectedItems()
    number = len(items)
    if number > 1:
        result = QtGui.QMessageBox.question(om_gui, "Confirm",
                                            _("Delete %d Posts?") % number,
                                            QtGui.QMessageBox.No | QtGui.QMessageBox.Yes,
                                            QtGui.QMessageBox.Yes)
        if result == QtGui.QMessageBox.Yes:
            for item in items:
                ix = int(item.text(1))
                forum.deletePost(ix)
    else:
        item = om_gui.ui.forum_treeWidget.currentItem()
        heading = item.text(0)

        result = QtGui.QMessageBox.question(om_gui, "Confirm",
                                            _("Delete selected Post?") +
                                            "<br />'%s'" % heading,
                                            QtGui.QMessageBox.No | QtGui.QMessageBox.Yes,
                                            QtGui.QMessageBox.Yes)
        if result == QtGui.QMessageBox.Yes:
            ix = int(item.text(1))
            forum.deletePost(ix)

    loadForum(om_gui)
コード例 #2
0
def forumDeleteItem(om_gui):
    '''
    delete a forum posting
    '''
    items = om_gui.ui.forum_treeWidget.selectedItems()
    number = len(items)
    if number > 1:
        if QtWidgets.QMessageBox.question(
                om_gui, _("Confirm"),
                "%s %d %s?" % (_("Delete"), number, _(" Posts")),
                QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes,
                QtWidgets.QMessageBox.Yes) == QtWidgets.QMessageBox.Yes:
            for item in items:
                ix = int(item.text(1))
                forum.deletePost(ix)
    else:
        item = om_gui.ui.forum_treeWidget.currentItem()
        heading = item.text(0)
        if QtWidgets.QMessageBox.question(
                om_gui, _("Confirm"),
                _("Delete selected Post?") + "<br />'%s'" % heading,
                QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes,
                QtWidgets.QMessageBox.Yes) == QtWidgets.QMessageBox.Yes:
            ix = int(item.text(1))
            forum.deletePost(ix)
    loadForum(om_gui)
コード例 #3
0
ファイル: forum_widget.py プロジェクト: vomae/openmolar1
 def forumDeleteItem(self):
     '''
     delete a forum posting
     '''
     self.apply_new_reads()
     items = self.tree_widget.selectedItems()
     number = len(items)
     if number > 1:
         if QtWidgets.QMessageBox.question(
                 self, _("Confirm"),
                 "%s %d %s?" % (_("Archive"), number, _(" Posts")),
                 QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes,
                 QtWidgets.QMessageBox.Yes) == QtWidgets.QMessageBox.Yes:
             for item in items:
                 post = item.data(0, QtCore.Qt.UserRole)
                 forum.deletePost(post.ix)
     else:
         item = self.tree_widget.currentItem()
         post = item.data(0, QtCore.Qt.UserRole)
         if QtWidgets.QMessageBox.question(
                 self, _("Confirm"),
                 _("Archived selected Post?") + "<br />'%s'" % post.topic,
                 QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes,
                 QtWidgets.QMessageBox.Yes) == QtWidgets.QMessageBox.Yes:
             forum.deletePost(post.ix)
     self.loadForum()
コード例 #4
0
def forumDeleteItem(om_gui):
    '''
    delete a forum posting
    '''
    items = om_gui.ui.forum_treeWidget.selectedItems()
    number = len(items)
    if number > 1:
        if QtWidgets.QMessageBox.question(
                om_gui, _("Confirm"),
                "%s %d %s?" % (_("Delete"), number, _(" Posts")),
                QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes,
                QtWidgets.QMessageBox.Yes) == QtWidgets.QMessageBox.Yes:
            for item in items:
                ix = int(item.text(1))
                forum.deletePost(ix)
    else:
        item = om_gui.ui.forum_treeWidget.currentItem()
        heading = item.text(0)
        if QtWidgets.QMessageBox.question(
                om_gui, _("Confirm"),
                _("Delete selected Post?") +
                "<br />'%s'" % heading,
                QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes,
                QtWidgets.QMessageBox.Yes) == QtWidgets.QMessageBox.Yes:
            ix = int(item.text(1))
            forum.deletePost(ix)
    loadForum(om_gui)
コード例 #5
0
 def forumDeleteItem(self):
     """
     delete a forum posting
     """
     self.apply_new_reads()
     items = self.tree_widget.selectedItems()
     number = len(items)
     if number > 1:
         if (
             QtWidgets.QMessageBox.question(
                 self,
                 _("Confirm"),
                 "%s %d %s?" % (_("Archive"), number, _(" Posts")),
                 QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes,
                 QtWidgets.QMessageBox.Yes,
             )
             == QtWidgets.QMessageBox.Yes
         ):
             for item in items:
                 post = item.data(0, QtCore.Qt.UserRole)
                 forum.deletePost(post.ix)
     else:
         item = self.tree_widget.currentItem()
         post = item.data(0, QtCore.Qt.UserRole)
         if (
             QtWidgets.QMessageBox.question(
                 self,
                 _("Confirm"),
                 _("Archived selected Post?") + "<br />'%s'" % post.topic,
                 QtWidgets.QMessageBox.No | QtWidgets.QMessageBox.Yes,
                 QtWidgets.QMessageBox.Yes,
             )
             == QtWidgets.QMessageBox.Yes
         ):
             forum.deletePost(post.ix)
     self.loadForum()