Пример #1
0
 def doubleck(self):
     critem = self.listWidget.currentItem()
     reply = QMessageBox.question(self.centralwidget, '删除', '确认删除吗?',
                                  QMessageBox.Yes | QMessageBox.No,
                                  QMessageBox.Yes)
     if reply == QMessageBox.Yes:
         self.listWidget.takeItem(self.listWidget.currentRow())
         del self.data[critem.text()]
         myjson.write('./data.json', self.data)
Пример #2
0
 def addtolist(self):  ## 添加到列表自动获取图片
     # closeproxy(self)
     text = self.lineEdit.text()
     if text not in self.mylist and text != "":
         self.data[text] = {"title": "未命名", "pic": []}
         self.mylist = list(self.data.keys())
         self.listWidget.clear()
         self.renderlist(self.mylist)
         myjson.write('./data.json', self.data)
     self.cacheimg()
Пример #3
0
 def doubleck(self):
     crrow = self.listWidget.currentRow()
     critem = self.mylist[crrow]
     reply = QMessageBox.question(self.centralwidget, '删除', '确认删除吗?',
                                  QMessageBox.Yes | QMessageBox.No,
                                  QMessageBox.Yes)
     if reply == QMessageBox.Yes:
         self.listWidget.takeItem(self.listWidget.currentRow())
         del self.data[critem]
         self.mylist = list(self.data.keys())
         self.listWidget.clear()
         self.renderlist(self.mylist)
         myjson.write('./data.json', self.data)
Пример #4
0
 def addtolist(self):  ## 添加到列表自动获取图片
     # closeproxy(self)
     text = self.lineEdit.text()
     if text not in self.mylist and text != "":
         item = QListWidgetItem(text)
         # item.setSizeHint(QSize(50,50))
         # layout_right_down = QHBoxLayout()  # 右下的横向布局
         # layout_right_down.addWidget(QLabel(text))
         # layout_right_down.addWidget(QLabel("label"))
         # wg= QWidget()
         # wg.setLayout(layout_right_down)
         # self.listWidget.setItemWidget(item, wg)
         self.listWidget.addItem(item)  # 创建本地缓存  载入时加载本地缓存!
         self.data[text] = []
         self.mylist = list(self.data.keys())
         myjson.write('./data.json', self.data)
     self.cacheimg()
Пример #5
0
 def savechange(self):
     print("字段保存")
     for index, i in enumerate(self.mylist):
         title = globals()['Qline_' + str(index)].text()
         self.data[i] = {"title": title, "pic": self.data[i]['pic']}
         myjson.write('./data.json', self.data)