From: <te...@us...> - 2003-07-30 11:07:16
|
Update of /cvsroot/quickrip/quickrip/gtk In directory sc8-pr-cvs1:/tmp/cvs-serv18058/gtk Added Files: gtkmain.py gtkprogress.py gtksettings.py Log Message: Various tweaks here and there, and the addition of the Gtk files to CVS --- NEW FILE: gtkmain.py --- #!/usr/bin/python #guimain: #should include the list of tracks once scanned, the #basic settings for each track (bitrate & file size with #indication of quality), and the quit/configure/scan/rip buttons. try: import pygtk pygtk.require("2.0") import gtk, gobject import gtksettings, gtkprogress from gtksettings import * from gtkprogress import * except: print "Couldn't load PyGTK module! Check it's installed properly." print "If you think it is, but you still get this message, please" print "see the frequent problems page online at:" print "http://quickrip.sf.net/fp.shtml" print "" print "Press Enter for the full GTK error message" deleteme = raw_input() del deleteme import pygtk pygtk.require("2.0") import gtk, gobject import gtksettings, gtkprogress from gtksettings import * from gtkprogress import * class GTKMain: def rip(self, widget, data=None): print "Rip" self.dialogProgress.window.show_all() def scan(self, widget, data=None): print "Scan" def configure(self, widget, data=None): self.dialogSettings.window.show_all() print "Configure" def quit(self, widget, data=None): print "quit" gtk.main_quit() return gtk.FALSE def about(self, widget, data=None): print "about" def manual(self, widget, data=None): print "manual" def create_gtk_list(self): scrolled_window = gtk.ScrolledWindow() scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) model = gtk.ListStore(gobject.TYPE_STRING) view = gtk.TreeView(model) scrolled_window.add_with_viewport(view) view.show() cell = gtk.CellRendererText() column1 = gtk.TreeViewColumn() column2 = gtk.TreeViewColumn() column3 = gtk.TreeViewColumn() column1.set_resizable(gtk.TRUE) column2.set_resizable(gtk.TRUE) column3.set_resizable(gtk.TRUE) column1.set_min_width(150) column2.set_min_width(150) column3.set_min_width(50) column1.set_title("Track") column2.set_title("Length") column3.set_title("Rip?") view.append_column(column1) view.append_column(column2) view.append_column(column3) return scrolled_window def build_menus(self): self.menuBar = gtk.MenuBar() self.menuFile = gtk.Menu() self.miFile = gtk.MenuItem("File") self.miFile.set_submenu(self.menuFile) self.menuBar.append(self.miFile) self.miScan = gtk.MenuItem("Scan") self.menuFile.append(self.miScan) self.miRip = gtk.MenuItem("Rip") self.menuFile.append(self.miRip) self.miQuit = gtk.MenuItem("Quit") self.menuFile.append(self.miQuit) self.menuOptions = gtk.Menu() self.miOptions = gtk.MenuItem("Options") self.miOptions.set_submenu(self.menuOptions) self.menuBar.append(self.miOptions) self.miPreferences = gtk.MenuItem("Configure") self.menuOptions.append(self.miPreferences) self.menuHelp = gtk.Menu() self.miHelp = gtk.MenuItem("Help") self.miHelp.set_submenu(self.menuHelp) self.menuBar.append(self.miHelp) self.miManual = gtk.MenuItem("Manual") self.menuHelp.append(self.miManual) self.miAbout = gtk.MenuItem("About") self.menuHelp.append(self.miAbout) self.miQuit.connect_object("activate", self.quit, None) self.miRip.connect_object("activate", self.rip, None) self.miScan.connect_object("activate", self.scan, None) self.miPreferences.connect_object("activate", self.configure, None) self.miAbout.connect_object("activate", self.about, None) self.miManual.connect_object("activate", self.manual, None) def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.connect("delete_event", self.quit) self.window.set_title("QuickRip") self.window.set_size_request(500, 480) self.dialogSettings = GTKSettings() self.dialogProgress = GTKProgress() self.boxMain = gtk.VBox(gtk.FALSE, 10) self.boxClient = gtk.HBox(gtk.TRUE, 10) self.frameTrackSettings = gtk.Frame("Track Settings") self.tableTrackSettings = gtk.Table(2, 4, gtk.TRUE) self.frameTrackSettings.add(self.tableTrackSettings) audlist = [ "64 kbps", "96 kbps", "112 kbps", "128 kbps", "160 kbps", "192 kbps", "224 kbps", "256 kbps", "320 kbps"] self.comboAudioBitrate = gtk.Combo() self.comboAudioBitrate.set_popdown_strings(audlist) self.tableTrackSettings.attach(gtk.Label("Target File Size:"), 0, 1, 0, 1) self.tableTrackSettings.attach(gtk.Label("Video Bitrate:"), 0, 1, 1, 2) self.tableTrackSettings.attach(gtk.Label("Audio Bitrate:"), 2, 3, 0, 1) self.tableTrackSettings.attach(self.comboAudioBitrate, 3, 4, 0, 1) self.frameOutputSettings = gtk.Frame("Output Settings:") self.tableOutputSettings = gtk.Table(2, 6, gtk.TRUE) self.frameOutputSettings.add(self.tableOutputSettings) vollist = [ "0", "+1", "+2", "+3", "+4", "+5", "+6", "+7", "+8", "+9", "+10" ] self.textOutputFile = gtk.TextView() self.comboLanguage = gtk.Combo() self.comboSubtitles = gtk.Combo() self.comboVolume = gtk.Combo() self.comboVolume.set_popdown_strings(vollist) self.widgetBrowse = gtk.Button("Browse") self.tableOutputSettings.attach(gtk.Label("Language:"), 0, 1, 0, 1) self.tableOutputSettings.attach(self.comboLanguage, 1, 2, 0, 1) self.tableOutputSettings.attach(gtk.Label("Subtitles:"), 2, 3, 0, 1) self.tableOutputSettings.attach(self.comboSubtitles, 3, 4, 0, 1) self.tableOutputSettings.attach(gtk.Label("Volume:"), 4, 5, 0, 1) self.tableOutputSettings.attach(self.comboVolume, 5, 6, 0, 1) self.tableOutputSettings.attach(gtk.Label("Target File:"), 0, 1, 1, 2) self.tableOutputSettings.attach(self.textOutputFile, 1, 5, 1, 2) #, GTK_FILL|GTK_ATTACH, 0) self.tableOutputSettings.attach(self.widgetBrowse, 5, 6, 1, 2) self.tracklist = self.create_gtk_list() self.build_menus() #################### event mapping self.widgetScan = gtk.Button("Scan") self.widgetRip = gtk.Button("Rip") self.widgetRip.connect("clicked", self.rip, None) self.widgetScan.connect("clicked", self.scan, None) self.widgetBrowse.connect("clicked", self.browse, None) ##################### packing and arrangements of widgets self.window.add(self.boxMain) self.boxMain.pack_start(self.menuBar, gtk.FALSE, gtk.FALSE, 0) self.boxMain.pack_start(self.tracklist, gtk.TRUE, gtk.TRUE, 0) self.boxMain.pack_start(self.frameTrackSettings) self.boxMain.pack_start(self.frameOutputSettings) self.boxMain.pack_end(self.boxClient, gtk.TRUE, gtk.TRUE, 0) self.boxClient.pack_start(self.widgetScan, gtk.TRUE, gtk.TRUE, 0) self.boxClient.pack_start(self.widgetRip, gtk.TRUE, gtk.TRUE, 0) ################################# Showing of objects self.window.show_all() def browse(self, widget, data=None): self.filesel = gtk.FileSelection() self.filesel.ok_button.connect("clicked", self.accept) self.filesel.cancel_button.connect("clicked", self.cancel) self.filesel.show() def cancel(self, widget): self.filesel.hide() def accept(self, widget): textbuf = gtk.TextBuffer() textbuf.set_text(self.filesel.get_filename()) self.textOutputFile.set_buffer(textbuf) self.filesel.hide() def main(self): gtk.main() def main(): app = GTKMain() app.main() --- NEW FILE: gtkprogress.py --- #!/usr/bin/python #guiprogress: #an indication of the track being ripped, #what number it is out of all being ripped (e.g. 1 of 5), #the ETA, #the progress on the particular pass, and a #cancel button (that stops the ripping and closes the dialogue) try: import pygtk pygtk.require("2.0") import gtk except: print "Couldn't load PyGTK module! Check it's installed properly." print "If you think it is, but you still get this message, please" print "see the frequent problems page online at:" print "http://quickrip.sf.net/fp.shtml" print "" print "Press Enter for the full GTK error message" deleteme = raw_input() del deleteme import pygtk pygtk.require("2.0") import gtk class GTKProgress: def quit(self, widget, data=None): print "close progress" self.window.hide() return gtk.TRUE def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_title("Rip in progress . . .") self.window.set_resizable(gtk.FALSE) self.window.set_border_width(5) self.window.set_size_request(300, 100) self.boxMain = gtk.VBox(gtk.FALSE, 0) self.boxClient = gtk.HBox(gtk.FALSE, 0) self.label = gtk.Label("Status, 1/5, etc") self.widgetCancel = gtk.Button("Cancel") self.progressBar = gtk.ProgressBar() self.progressBar.set_text("Some percent") #################### event mapping self.window.connect("delete_event", self.quit) self.widgetCancel.connect("clicked", self.quit, None) ##################### packing and arrangements of widgets self.window.add(self.boxMain) self.boxMain.pack_start(self.progressBar) self.boxMain.pack_end(self.boxClient, gtk.TRUE, gtk.TRUE, 0) self.boxClient.pack_start(self.label, gtk.FALSE, gtk.FALSE, 0) self.boxClient.pack_end(self.widgetCancel, gtk.FALSE, gtk.FALSE, 0) ################################# Showing of objects # self.window.show_all() def main(self): gtk.main() if __name__ == "__main__": app = GTKProgress() app.main() --- NEW FILE: gtksettings.py --- #!/usr/bin/python #guisettings: #should contain all other settings, in sections: #general - audio / language / other #paths - output dir / programs / devices #mencoder - deinterlacing, aspect ratio, etc try: import pygtk pygtk.require("2.0") import gtk except: print "Couldn't load PyGTK module! Check it's installed properly." print "If you think it is, but you still get this message, please" print "see the frequent problems page online at:" print "http://quickrip.sf.net/fp.shtml" print "" print "Press Enter for the full GTK error message" deleteme = raw_input() del deleteme import pygtk pygtk.require("2.0") import gtk class GTKSettings: def quit(self, widget, data=None): print "close settigns" self.window.hide() return gtk.TRUE def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.set_title("Preferences") self.window.connect("delete_event", self.quit) self.window.set_size_request(400, 300) # self.window.set_resizable(gtk.TRUE) # self.window.set_border_width(0) self.pageGeneral = gtk.VBox(gtk.FALSE, 0) self.pagePaths = gtk.VBox(gtk.FALSE, 0) self.pageMencoder = gtk.VBox(gtk.FALSE, 0) self.notebook = gtk.Notebook() self.clickGeneral = gtk.Label("General") self.clickPaths = gtk.Label("Paths") self.clickMencoder = gtk.Label("Mencoder") self.notebook.append_page(self.pageGeneral, self.clickGeneral) self.notebook.append_page(self.pagePaths, self.clickPaths) self.notebook.append_page(self.pageMencoder, self.clickMencoder) self.window.add(self.notebook) # self.window.show_all() def main(self): gtk.main() if __name__ == "__main__": app = GTKSettings() app.main() |