Skip to content

Commit 105f570

Browse files
committed
stoped deletion to shuffle and + efficiency
1 parent c0fad50 commit 105f570

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Diff for: image_in_window_screensaver/image_widget.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,19 @@ def image_previous(self):
9090
def image_delete(self):
9191
l.log("delete: " + self._all_images[self._current_index])
9292
send2trash(self._all_images[self._current_index])
93-
# self._all_images: List = file_walker.walk(sys.argv[1])
94-
self._all_images: List = file_walker.walk(file_walker.get_mode())
93+
self._all_images.remove(self._all_images[self._current_index])
9594
self._set_image(self._current_index)
96-
# self.image_shuffle()
9795

9896
def _set_image(self, index):
99-
if index > len(self._all_images)-1:
97+
if index > len(self._all_images)-1 or index < -1*len(self._all_images):
10098
l.log("error: shuffling again")
10199
index = 0
100+
self._current_index = index
102101
l.log("setting image")
103-
image_pix_map = QPixmap(self._all_images[index])
102+
image_pix_map = QPixmap(self._all_images[self._current_index])
104103
print("image: ", image_pix_map.width(), image_pix_map.height())
105104
self._image_label.setPixmap(image_pix_map)
106-
self.set_title(self._all_images[index])
105+
self.set_title(self._all_images[self._current_index])
107106

108107
# def set_line_edit(self, edit_line: QLineEdit):
109108
# self._line_edit = edit_line

0 commit comments

Comments
 (0)