ViewManager/BookmarkedFilesDialog.py

changeset 3656
441956d8fce5
parent 3484
645c12de6b0c
child 4021
195a471c327b
equal deleted inserted replaced
3654:ffeb85cdc72d 3656:441956d8fce5
7 Module implementing a configuration dialog for the bookmarked files menu. 7 Module implementing a configuration dialog for the bookmarked files menu.
8 """ 8 """
9 9
10 from __future__ import unicode_literals 10 from __future__ import unicode_literals
11 11
12 from PyQt4.QtCore import QFileInfo, Qt, pyqtSlot 12 from PyQt5.QtCore import QFileInfo, Qt, pyqtSlot
13 from PyQt4.QtGui import QListWidgetItem, QColor, QDialog 13 from PyQt5.QtGui import QColor
14 from PyQt5.QtWidgets import QListWidgetItem, QDialog
14 15
15 from E5Gui.E5Completers import E5FileCompleter 16 from E5Gui.E5Completers import E5FileCompleter
16 from E5Gui import E5FileDialog 17 from E5Gui import E5FileDialog
17 18
18 from .Ui_BookmarkedFilesDialog import Ui_BookmarkedFilesDialog 19 from .Ui_BookmarkedFilesDialog import Ui_BookmarkedFilesDialog
41 42
42 self.bookmarks = bookmarks[:] 43 self.bookmarks = bookmarks[:]
43 for bookmark in self.bookmarks: 44 for bookmark in self.bookmarks:
44 itm = QListWidgetItem(bookmark, self.filesList) 45 itm = QListWidgetItem(bookmark, self.filesList)
45 if not QFileInfo(bookmark).exists(): 46 if not QFileInfo(bookmark).exists():
46 itm.setBackgroundColor(QColor(Qt.red)) 47 itm.setBackground(QColor(Qt.red))
47 48
48 if len(self.bookmarks): 49 if len(self.bookmarks):
49 self.filesList.setCurrentRow(0) 50 self.filesList.setCurrentRow(0)
50 51
51 def on_fileEdit_textChanged(self, txt): 52 def on_fileEdit_textChanged(self, txt):
89 bookmark = self.fileEdit.text() 90 bookmark = self.fileEdit.text()
90 if bookmark: 91 if bookmark:
91 bookmark = Utilities.toNativeSeparators(bookmark) 92 bookmark = Utilities.toNativeSeparators(bookmark)
92 itm = QListWidgetItem(bookmark, self.filesList) 93 itm = QListWidgetItem(bookmark, self.filesList)
93 if not QFileInfo(bookmark).exists(): 94 if not QFileInfo(bookmark).exists():
94 itm.setBackgroundColor(QColor(Qt.red)) 95 itm.setBackground(QColor(Qt.red))
95 self.fileEdit.clear() 96 self.fileEdit.clear()
96 self.bookmarks.append(bookmark) 97 self.bookmarks.append(bookmark)
97 row = self.filesList.currentRow() 98 row = self.filesList.currentRow()
98 self.on_filesList_currentRowChanged(row) 99 self.on_filesList_currentRowChanged(row)
99 100
107 bookmark = Utilities.toNativeSeparators(bookmark) 108 bookmark = Utilities.toNativeSeparators(bookmark)
108 self.bookmarks[row] = bookmark 109 self.bookmarks[row] = bookmark
109 itm = self.filesList.item(row) 110 itm = self.filesList.item(row)
110 itm.setText(bookmark) 111 itm.setText(bookmark)
111 if not QFileInfo(bookmark).exists(): 112 if not QFileInfo(bookmark).exists():
112 itm.setBackgroundColor(QColor(Qt.red)) 113 itm.setBackground(QColor(Qt.red))
113 else: 114 else:
114 itm.setBackgroundColor(QColor()) 115 itm.setBackground(QColor())
115 116
116 @pyqtSlot() 117 @pyqtSlot()
117 def on_deleteButton_clicked(self): 118 def on_deleteButton_clicked(self):
118 """ 119 """
119 Private slot to delete the selected entry. 120 Private slot to delete the selected entry.

eric ide

mercurial