Thanks for the reply Gokulnathvc.
I am making a list of movies using QListWidget. What I want to do is that, when I single click an item, in the list, my call back function should display the properties of that item. And when I select multiple item by using mouse or keyboard, another event should get triggered and it should return me all the selected items. I am still using the single click function for it and then deciding on the number of items selected to make the decision. Using the following code:
def single_click_function (self, event):
items = self.unsubmittedList.selectedItems() #unsubmittedList is QListWidget
# items = self.unsubmittedList.GetItems()
# selected = self.unsubmittedList.GetSelections()
if self.WIN_32:
if len(selected) == 1: #If I select 1 item
version = items[selected[0]]
for ver in self.unsubmitted_versions:
if version == ver["code"]:
time = datetime.fromtimestamp(mktime(ver["created_at"].timetuple()))
self.rangeText.SetLabel(ver["frame_range"])
self.descText.SetLabel(str(ver["description"]))
self.shotRangeText.SetLabel(ver["render_range"])
self.createdText.SetLabel(time.strftime("%d/%m/%Y %H:%M"))
else: #If more than one item
self.rangeText.SetLabel("")
self.descText.SetLabel("")
self.shotRangeText.SetLabel("")
self.createdText.SetLabel("")
path = '"'
for ver1 in self.unsubmitted_versions: #unsubmitted_versions contains my movies.
for item in selected:
if ver1["code"] == items[item]:
path += ver1["sg_uploaded_movie"]["local_path_windows"] + '" "'
path = path[:-2]
path_win = path
if self.qt_process:
try:
self.qt_process.terminate()
except:
pass
if path:
cmd = self.player + ' ' + path_win
self.qt_process = Popen(shlex.split(cmd))
else:
self.rangeText.SetLabel("")
self.descText.SetLabel("")
self.shotRangeText.SetLabel("")
self.createdText.SetLabel("")
This code was working fine on wx but now I am using Qt and dont know why it is not working now.
Any help would be appreciated.
Cheers
Bookmarks