1 from gi.repository
import Gtk
as gtk
9 self.
window = gtk.Window(gtk.WindowType.TOPLEVEL)
10 self.window.set_title(
'TRS Splitter')
11 self.window.connect(
'destroy',
lambda w: gtk.main_quit())
12 self.window.set_border_width(10)
13 self.window.set_default_size(150, 100)
15 box = gtk.VBox(
False, 5)
16 split_button = UIUtils.create_button(
'Split File', UIUtils.BUTTON_ICONS.SPLIT)
17 split_button.connect(
'clicked',
lambda w: self.
split_file())
18 box.pack_start(split_button,
False,
False, 0)
21 merge_button = UIUtils.create_button(
'Merge Files', UIUtils.BUTTON_ICONS.MERGE)
22 merge_button.connect(
'clicked',
lambda w: self.
merge_files())
23 box.pack_start(merge_button,
False,
False, 0)
26 exit_button = UIUtils.create_button(
'Exit', UIUtils.BUTTON_ICONS.EXIT)
27 exit_button.connect(
'clicked',
lambda w: gtk.main_quit())
28 box.pack_start(exit_button,
False,
False, 0)
36 filename = UIUtils.open_file(
'Select trs file', [UIUtils.TRS_FILE_FILTER, UIUtils.ALL_FILE_FILTER])
40 dialog = gtk.FileChooserDialog(title=
'Select Folder for Split Files',
41 action=gtk.FileChooserAction.SELECT_FOLDER,
42 buttons=(gtk.STOCK_CANCEL, gtk.ResponseType.CANCEL, gtk.STOCK_OPEN, gtk.ResponseType.OK))
43 dialog.set_default_response(gtk.ResponseType.OK)
45 response = dialog.run()
46 if response == gtk.ResponseType.OK:
47 dest_folder = dialog.get_filename()
53 dialog = gtk.FileChooserDialog(title=
'Select Folder Containing Split Files',
54 action=gtk.FileChooserAction.SELECT_FOLDER,
55 buttons=(gtk.STOCK_CANCEL, gtk.ResponseType.CANCEL, gtk.STOCK_OPEN, gtk.ResponseType.OK))
56 dialog.set_default_response(gtk.ResponseType.OK)
58 response = dialog.run()
59 if response == gtk.ResponseType.OK:
60 src_folder = dialog.get_filename()
63 progress_dialog =
ProgressDialog(title=
'Merging files', phases=[
'Merging TRS files...'])
64 progress_dialog.show()
66 merger.merge(progress_dialog.set_fraction)