def on_pick_release(event: wx.CommandEvent): # self._version = event.GetString() release = event.GetClientData() self.bin_picker.Clear() if release: for asset in release.get_assets(): if asset.name.endswith(".bin"): self.bin_picker.Append(asset.name, asset) self._version = self.bin_picker.GetClientData( self.bin_picker.CurrentSelection)
def _on_image_modify(self, event: wx.CommandEvent): """ Move image up/down one position, remove or edit them. :param event: Used to distinguish between up/down buttons. And contains reference to the image that is being moved. :return: None """ self._img_index = self._images.index(event.GetClientData()) # Rearrange the images in the list if event.GetId() == wx.ID_UP: if self._img_index == 0: return self._images[self._img_index], self._images[self._img_index - 1] = \ self._images[self._img_index - 1], self._images[self._img_index] set_modified = True elif event.GetId() == wx.ID_DOWN: if self._img_index + 1 == len(self._images): return self._images[self._img_index], self._images[self._img_index + 1] = \ self._images[self._img_index + 1], self._images[self._img_index] set_modified = True # Remove image from list elif event.GetId() == wx.ID_DELETE: result = wx.MessageBox(Strings.text_remove_image, Strings.status_warning, wx.YES_NO | wx.ICON_WARNING) if result == wx.YES: del self._images[self._img_index] set_modified = True else: # Modify image data edit_dialog = EditAsideImageDialog( self, self._images[self._img_index], self._doc.get_working_directory()) edit_dialog.ShowModal() set_modified = edit_dialog.was_modified() edit_dialog.Destroy() self.show_images() # Pass the event into the main frame to change document color in the file list. Always send the event because # that runs spellcheck on the rest of the frame in case we learned new words, but indicate whether we made # any changes to set the document modified. color_evt = Events.SidepanelChangedEvent(self.GetId()) if set_modified: color_evt.SetInt(1) else: color_evt.SetInt(0) wx.PostEvent(self.GetEventHandler(), color_evt)
def on_pick_version(event: wx.CommandEvent): self._version = event.GetClientData()