MCPcopy Index your code
hub / github.com/rawpython/remi / FileFolderItem

Class FileFolderItem

remi/gui.py:3891–3931  ·  view source on GitHub ↗

FileFolderItem widget for the FileFolderNavigator

Source from the content-addressed store, hash-verified

3889
3890
3891class FileFolderItem(Container):
3892 """FileFolderItem widget for the FileFolderNavigator"""
3893 path_and_filename = None #the complete path and filename
3894 def __init__(self, path_and_filename, text, is_folder=False, *args, **kwargs):
3895 super(FileFolderItem, self).__init__(*args, **kwargs)
3896 self.path_and_filename = path_and_filename
3897 self.isFolder = is_folder
3898 self.icon = Widget(_class='FileFolderItemIcon')
3899 # the icon click activates the onselection event, that is propagates to registered listener
3900 if is_folder:
3901 self.icon.onclick.connect(self.onclick)
3902 else:
3903 self.icon.onclick.connect(self.onselection)
3904 icon_file = '/res:folder.png' if is_folder else '/res:file.png'
3905 self.icon.css_background_image = "url('%s')" % icon_file
3906 self.label = Label(text)
3907 self.label.onclick.connect(self.onselection)
3908 self.append(self.icon, key='icon')
3909 self.append(self.label, key='text')
3910 self.selected = False
3911
3912 def set_selected(self, selected):
3913 self.selected = selected
3914 self.label.css_font_weight = 'bold' if self.selected else 'normal'
3915
3916 @decorate_set_on_listener("(self, emitter)")
3917 @decorate_event
3918 def onclick(self, widget):
3919 return super(FileFolderItem, self).onclick()
3920
3921 @decorate_set_on_listener("(self, emitter)")
3922 @decorate_event
3923 def onselection(self, widget):
3924 self.set_selected(not self.selected)
3925 return ()
3926
3927 def set_text(self, t):
3928 self.children['text'].set_text(t)
3929
3930 def get_text(self):
3931 return self.children['text'].get_text()
3932
3933
3934class FileSelectionDialog(GenericDialog):

Callers 1

populate_folder_itemsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected