Source code for load_modulo_gtk

# load_folders_gtk.py
# By MW, Jul 2013
# GPLv3+
#
# Graphical interface to load multi folders data

import gtk, logging, imp
LoadFolders = imp.load_source("LoadFolders", './bin/Movies/Loader/load_folders.py')


[docs]class Loader : def __init__(self) : self.main_label = "Not implemented yet" self.name = "Channels in one folder" self.lines_list = [] self.loader = LoadFolders.Loader()
[docs] def get_frames_object(self) : """Queries an object like : [{name: " ", frames: (..., ...)}, ...]""" for line in self.lines_list : self.loader.add_channel(line['path_w'].get_text(), line['name_w'].get_text()) return self.loader.get_frames_object()
[docs] def get_panel(self) : mainbox = gtk.VBox() main_l = gtk.Label(self.main_label) main_l.set_line_wrap_mode(True) mainbox.pack_start(main_l, fill=False, expand=False) """frame = gtk.Frame("Folders") mainbox.pack_start(frame, fill=True, expand=False) frame_box = gtk.VBox() self.box = gtk.VBox() frame_box.pack_start(self.box, expand=True, fill=True) frame.add(frame_box) line = self.get_newline() self.box.pack_start(line, expand=False, fill=False) add = gtk.Button() add_i = gtk.Image() add_i.set_from_stock(gtk.STOCK_ADD, gtk.ICON_SIZE_SMALL_TOOLBAR) add.add(add_i) add.set_tooltip_text("Add channel") add.connect('clicked', self.add_channel_evt) #add.connect("clicked", self.previous_next_clicked, -1) frame_bottom_box = gtk.HBox() frame_bottom_box.pack_start(gtk.Label(' '), fill=True, expand=True) frame_bottom_box.pack_start(add, fill=False, expand=False) frame_box.pack_start(frame_bottom_box, fill=False, expand=False)""" mainbox.show_all() return mainbox
[docs] def get_name(self) : return self.name
[docs] def browse_evt(self, w, path_e) : dialog = gtk.FileChooserDialog("Select folder with channels", action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OK, gtk.RESPONSE_OK)) resp = dialog.run() if resp == gtk.RESPONSE_OK : f = dialog.get_filename() logging.info("Folder selected %s", f) path_e.set_text(f) dialog.destroy()