def restore(self): """restores a griffith compressed backup""" filename = gutils.file_chooser(_("Restore Griffith backup"), \ action=gtk.FILE_CHOOSER_ACTION_OPEN, buttons= \ (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, \ gtk.STOCK_OPEN, gtk.RESPONSE_OK)) if filename[0]: try: zip = zipfile.ZipFile(filename[0], 'r') except: gutils.error(self, _("Can't read backup file"), self.widgets['window']) return False mypath = os.path.join(self.locations['posters']) for each in zip.namelist(): file_to_restore = os.path.split(each) if not os.path.isdir(file_to_restore[1]): if file_to_restore[1] == '': continue if file_to_restore[1].endswith('.jpg'): myfile = os.path.join(mypath,file_to_restore[1]) else: myfile = os.path.join(self.locations['home'],file_to_restore[1]) outfile = open(myfile, 'wb') outfile.write(zip.read(each)) outfile.flush() outfile.close() zip.close() # restore config file self.config = config.Config(file=os.path.join(self.locations['home'],'griffith.conf')) filename = os.path.join(self.locations['home'], self.config["default_db"]) self.db.metadata.engine.dispose() # close DB from sqlalchemy.orm import clear_mappers clear_mappers() # check if file needs conversion if self.config['default_db'].lower().endswith('.gri'): self.debug.show('Old database format detected. Converting...') from dbupgrade import convert_from_old_db from initialize import location_posters if convert_from_old_db(self, filename, os.path.join(self.locations['home'], 'griffith.db')): self.config.save() location_posters(self.locations, self.config) else: print 'Cant convert old database, exiting.' import sys sys.exit(4) self.db = sql.GriffithSQL(self.config, self.debug, self.locations['home']) from initialize import dictionaries, people_treeview dictionaries(self) people_treeview(self) # let's refresh the treeview self.clear_details() self.populate_treeview() self.go_last() self.treeview_clicked() self.count_statusbar() gutils.info(self, _("Backup restored"), self.widgets['window'])
def restore(self, merge=False): """ Merge database from: * compressed backup (*.zip) * SQLite2 *.gri file * SQLite3 *.db file """ # let user select a backup file filename = gutils.file_chooser(_("Restore Griffith backup"), \ action=gtk.FILE_CHOOSER_ACTION_OPEN, backup=True, \ buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK)) if not filename: log.debug('no file selected') return False try: tmp_db = None tmp_dir = mkdtemp() os.mkdir(os.path.join(tmp_dir, 'posters')) print filename if filename.lower().endswith('.zip'): try: zip_file = zipfile.ZipFile(filename, 'r') except: gutils.error(_("Can't read backup file"), self.widgets['window']) return False old_config_file = False # unpack files to temporary directory for file_path in zip_file.namelist(): file_name = os.path.split(file_path)[-1] if not os.path.isdir(file_name): if not file_name: log.debug('skipping %s', file_path) continue if 'posters' in file_path: new_file = os.path.join(tmp_dir, 'posters', file_name) else: new_file = os.path.join(tmp_dir, file_name) if file_name.endswith('.conf'): old_config_file = new_file outfile = open(new_file, 'wb') outfile.write(zip_file.read(file_path)) outfile.close() zip_file.close() # restore config file (new one will be created if old config format is detected) tmp_config = config.Config(file=os.path.join(tmp_dir, 'griffith.cfg')) if old_config_file: log.info('Old config file detected. Please note that it will not be used.') f = open(old_config_file, 'r') old_config_raw_data = f.read() f.close() if old_config_raw_data.find('griffith.gri') >= -1: tmp_config.set('file', 'griffith.gri', section='database') # update filename var. to point to the unpacked database filename = os.path.join(tmp_dir, tmp_config.get('name', 'griffith', section='database') + '.db') else: # not a zip file? prepare a fake config file then tmp_config = config.Config(file=os.path.join(tmp_dir, 'griffith.cfg')) tmp_config.set('type', 'sqlite', section='database') tmp_config.set('file', 'griffith.db', section='database') # prepare temporary GriffithSQL instance locations = {'home': tmp_dir} # check if file needs conversion if filename.lower().endswith('.gri'): from dbupgrade import convert_from_old_db tmp_db = convert_from_old_db(tmp_config, filename, os.path.join(tmp_dir, 'griffith.db'), locations) if not tmp_db: log.info("MERGE: Can't convert database, aborting.") return False else: tmp_db = sql.GriffithSQL(tmp_config, tmp_dir, fallback=False) if merge: merge_db(tmp_db, self.db) else: self.db.session.rollback() # cancel all pending operations copy_db(tmp_db.session.bind, self.db.session.bind) # update old database section with current config values # (important while restoring to external databases) for key in ('name', 'passwd', 'host', 'user', 'file', 'type', 'port'): tmp_config.set(key, self.config.get(key, section='database'), section='database') tmp_config._file = self.config._file self.config = tmp_config self.config.save() dictionaries(self) people_treeview(self) # let's refresh the treeview self.clear_details() self.populate_treeview() #gutils.info(_("Databases merged!\n\nProcessed movies: %s\nMerged movies: %s"%(movies, merged)), self.widgets['window']) gutils.info(_("Backup restored"), self.widgets['window']) except: log.exception('') raise finally: # disposing the temporary db connection before rmtree and in finally block to avoid locked db file if tmp_db: tmp_db.dispose() log.debug('temporary directory no logger needed, removing %s', tmp_dir) rmtree(tmp_dir)
def restore(self, merge=False): """ Merge database from: * compressed backup (*.zip) * SQLite2 *.gri file * SQLite3 *.db file """ # let user select a backup file filename, path = gutils.file_chooser(_("Restore Griffith backup"), \ action=gtk.FILE_CHOOSER_ACTION_OPEN, backup=True, \ buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK)) if not filename: log.debug('no file selected') return False try: tmp_db = None tmp_dir = mkdtemp() os.mkdir(os.path.join(tmp_dir, 'posters')) print filename if filename.lower().endswith('.zip'): try: zip_file = zipfile.ZipFile(filename, 'r') except: gutils.error(_("Can't read backup file"), self.widgets['window']) return False old_config_file = False # unpack files to temporary directory for file_path in zip_file.namelist(): file_name = os.path.split(file_path)[-1] if not os.path.isdir(file_name): if not file_name: log.debug('skipping %s', file_path) continue if 'posters' in file_path: new_file = os.path.join(tmp_dir, 'posters', file_name) else: new_file = os.path.join(tmp_dir, file_name) if file_name.endswith('.conf'): old_config_file = new_file outfile = open(new_file, 'wb') outfile.write(zip_file.read(file_path)) outfile.close() zip_file.close() # restore config file (new one will be created if old config format is detected) tmp_config = config.Config(file=os.path.join(tmp_dir, 'griffith.cfg')) if old_config_file: log.info('Old config file detected. Please note that it will not be used.') f = open(old_config_file, 'r') old_config_raw_data = f.read() f.close() if old_config_raw_data.find('griffith.gri') >= -1: tmp_config.set('file', 'griffith.gri', section='database') # update filename var. to point to the unpacked database filename = os.path.join(tmp_dir, tmp_config.get('name', 'griffith', section='database') + '.db') else: # not a zip file? prepare a fake config file then tmp_config = config.Config(file=os.path.join(tmp_dir, 'griffith.cfg')) tmp_config.set('type', 'sqlite', section='database') tmp_config.set('file', 'griffith.db', section='database') # prepare temporary GriffithSQL instance locations = {'home': tmp_dir} # check if file needs conversion if filename.lower().endswith('.gri'): from dbupgrade import convert_from_old_db tmp_db = convert_from_old_db(tmp_config, filename, os.path.join(tmp_dir, 'griffith.db'), locations) if not tmp_db: log.info("MERGE: Can't convert database, aborting.") return False else: tmp_db = sql.GriffithSQL(tmp_config, tmp_dir, fallback=False) if merge: merge_db(tmp_db, self.db) else: self.db.session.rollback() # cancel all pending operations copy_db(tmp_db.session.bind, self.db.session.bind) # update old database section with current config values # (important while restoring to external databases) for key in ('name', 'passwd', 'host', 'user', 'file', 'type', 'port'): tmp_config.set(key, self.config.get(key, section='database'), section='database') tmp_config._file = self.config._file self.config = tmp_config self.config.save() dictionaries(self) people_treeview(self) # let's refresh the treeview self.clear_details() self.populate_treeview() #gutils.info(_("Databases merged!\n\nProcessed movies: %s\nMerged movies: %s"%(movies, merged)), self.widgets['window']) gutils.info(_("Backup restored"), self.widgets['window']) except: log.exception('') raise finally: # disposing the temporary db connection before rmtree and in finally block to avoid locked db file if tmp_db: tmp_db.dispose() log.debug('temporary directory no logger needed, removing %s', tmp_dir) rmtree(tmp_dir)
def restore(self): """restores a griffith compressed backup""" filename = gutils.file_chooser(_("Restore Griffith backup"), \ action=gtk.FILE_CHOOSER_ACTION_OPEN, buttons= \ (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, \ gtk.STOCK_OPEN, gtk.RESPONSE_OK)) if filename[0]: try: zip = zipfile.ZipFile(filename[0], 'r') except: gutils.error(self, _("Can't read backup file"), self.widgets['window']) return False mypath = os.path.join(self.locations['posters']) old_config_file = False for each in zip.namelist(): file_to_restore = os.path.split(each) if not os.path.isdir(file_to_restore[1]): if file_to_restore[1] == '': continue if file_to_restore[1].endswith('.jpg'): myfile = os.path.join(mypath,file_to_restore[1]) else: myfile = os.path.join(self.locations['home'],file_to_restore[1]) if file_to_restore[1].endswith('.conf'): old_config_file = myfile outfile = open(myfile, 'wb') outfile.write(zip.read(each)) outfile.flush() outfile.close() zip.close() # restore config file self.config = config.Config(file=os.path.join(self.locations['home'],'griffith.cfg')) if old_config_file: log.info('Old config file detected. Please note that it will not be used.') f = open(old_config_file, 'r') old_config_raw_data = f.read() f.close() if old_config_raw_data.find('griffith.gri') >= -1: self.config.set('file', 'griffith.gri', section='database') filename = os.path.join(self.locations['home'], self.config.get('name', 'griffith', section='database') + '.db') self.db.session.bind.engine.dispose() # close DB # check if file needs conversion if self.config.get('file', 'griffith.db', section='database').lower().endswith('.gri'): log.info('Old database format detected. Converting...') from dbupgrade import convert_from_old_db if convert_from_old_db(self, filename, os.path.join(self.locations['home'], 'griffith.db')): self.config.save() else: log.error('Cant convert old database, exiting.') import sys sys.exit(4) self.db = sql.GriffithSQL(self.config, self.locations['home'], self.locations) from initialize import dictionaries, people_treeview dictionaries(self) people_treeview(self) # let's refresh the treeview self.clear_details() self.populate_treeview() gutils.info(_("Backup restored"), self.widgets['window'])
def __init__(self, *args, **kwds): # debug object global debug debug = self.debug = gdebug.GriffithDebug() gconsole.check_args(self) initialize.locations(self) initialize.i18n(self, self.locations['i18n']) self.posix = (os.name == 'posix') # Configuration if self._tmp_config.find('/') >=0 or self._tmp_config.find('\\') >=0: configFileName = self._tmp_config else: configFileName = os.path.join(self.locations['home'], self._tmp_config) self.config = config.Config(file=configFileName) initialize.location_posters(self.locations, self.config) # convert old database filename = os.path.join(self.locations['home'], self.config.get('file', 'griffith.db', section='database')) if self.config.get('file', 'griffith.db', section='database').lower().endswith('.gri'): debug.show('Old database format detected. Converting...') from dbupgrade import convert_from_old_db if convert_from_old_db(self, filename, os.path.join(self.locations['home'], 'griffith.db')): self.config.save() initialize.location_posters(self.locations, self.config) else: print 'Cant convert old database, exiting.' sys.exit(4) # create/connect db from sql import GriffithSQL self.db = GriffithSQL(self.config, self.debug, self.locations['home']) # let's check any console arguments to parse gconsole.check_args_with_db(self) self.filter_l = False # begin wxGlade: MainFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.window_1 = wx.SplitterWindow(self, -1, style=wx.SP_3D|wx.SP_BORDER|wx.SP_LIVE_UPDATE) self.window_1_pane_2 = wx.Panel(self.window_1, -1) self.notebook_1 = wx.Notebook(self.window_1_pane_2, -1, style=0) self.window_1_pane_1 = wx.Panel(self.window_1, -1) # Menu Bar self.main_frame_menubar = wx.MenuBar() wxglade_tmp_menu = wx.Menu() self.new = wx.MenuItem(wxglade_tmp_menu, 1, _("&New"), _("Start a blank database"), wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.new) self.save_as = wx.MenuItem(wxglade_tmp_menu, 2, _("Save as..."), _("Make a backup of the database"), wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.save_as) self.revert = wx.MenuItem(wxglade_tmp_menu, 3, _("Revert"), _("Revert to a previous database backup"), wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.revert) wxglade_tmp_menu.AppendSeparator() self.import_data = wx.MenuItem(wxglade_tmp_menu, 4, _("Import"), "", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.import_data) self.export_data = wx.MenuItem(wxglade_tmp_menu, 5, _("Export"), "", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.export_data) wxglade_tmp_menu.AppendSeparator() self._print = wx.MenuItem(wxglade_tmp_menu, 6, _("Print"), "", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self._print) wxglade_tmp_menu.AppendSeparator() self.exit = wx.MenuItem(wxglade_tmp_menu, wx.ID_EXIT, _("Exit"), _("Terminate the program"), wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.exit) self.main_frame_menubar.Append(wxglade_tmp_menu, _("File")) wxglade_tmp_menu = wx.Menu() self.add = wx.MenuItem(wxglade_tmp_menu, 7, _("Add"), _("Add a new record"), wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.add) self.delete = wx.MenuItem(wxglade_tmp_menu, 8, _("Delete"), _("Deletes a record"), wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.delete) self.edit = wx.MenuItem(wxglade_tmp_menu, 9, _("Edit"), _("Edit a record"), wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.edit) self.duplicate = wx.MenuItem(wxglade_tmp_menu, 10, _("Duplicate"), _("Duplicates a record"), wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.duplicate) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu_sub = wx.Menu() self.open = wx.MenuItem(wxglade_tmp_menu_sub, 11, _("Open"), _("Opens the poster viewer"), wx.ITEM_NORMAL) wxglade_tmp_menu_sub.AppendItem(self.open) self.fetch = wx.MenuItem(wxglade_tmp_menu_sub, 12, _("Fetch from Amazon"), _("Fetches a poster using Amazon service"), wx.ITEM_NORMAL) wxglade_tmp_menu_sub.AppendItem(self.fetch) self.erase = wx.MenuItem(wxglade_tmp_menu_sub, 13, _("Erase"), _("Erase the current poster"), wx.ITEM_NORMAL) wxglade_tmp_menu_sub.AppendItem(self.erase) wxglade_tmp_menu.AppendMenu(wx.NewId(), _("Poster image"), wxglade_tmp_menu_sub, "") self.main_frame_menubar.Append(wxglade_tmp_menu, _("Edit")) wxglade_tmp_menu = wx.Menu() self.view_toolbar = wx.MenuItem(wxglade_tmp_menu, 14, _("Toolbar"), _("Toggles toolbar visibility"), wx.ITEM_CHECK) wxglade_tmp_menu.AppendItem(self.view_toolbar) wxglade_tmp_menu.AppendSeparator() self.view_not_seen = wx.MenuItem(wxglade_tmp_menu, 15, _("Not seen"), _("View only not seen"), wx.ITEM_RADIO) wxglade_tmp_menu.AppendItem(self.view_not_seen) self.view_loaned = wx.MenuItem(wxglade_tmp_menu, 16, _("Loaned"), _("View only loaned"), wx.ITEM_RADIO) wxglade_tmp_menu.AppendItem(self.view_loaned) self.view_all = wx.MenuItem(wxglade_tmp_menu, 17, _("All"), _("View all records"), wx.ITEM_RADIO) wxglade_tmp_menu.AppendItem(self.view_all) self.main_frame_menubar.Append(wxglade_tmp_menu, _("View")) wxglade_tmp_menu = wx.Menu() self.suggest = wx.MenuItem(wxglade_tmp_menu, 18, _("Suggest"), _("Suggest an unseen film"), wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.suggest) wxglade_tmp_menu_sub = wx.Menu() self.print_cover_builtin = wx.MenuItem(wxglade_tmp_menu_sub, 19, _("Built-in"), _("Prints a cover with record data"), wx.ITEM_NORMAL) wxglade_tmp_menu_sub.AppendItem(self.print_cover_builtin) self.prints_cover_custom = wx.MenuItem(wxglade_tmp_menu_sub, 20, _("Custom"), _("Prints a cover with a custom image"), wx.ITEM_NORMAL) wxglade_tmp_menu_sub.AppendItem(self.prints_cover_custom) wxglade_tmp_menu.AppendMenu(wx.NewId(), _("Print cover"), wxglade_tmp_menu_sub, "") wxglade_tmp_menu.AppendSeparator() self.preferences = wx.MenuItem(wxglade_tmp_menu, wx.ID_PREFERENCES, _("Preferences"), _("Define the preferences"), wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.preferences) self.main_frame_menubar.Append(wxglade_tmp_menu, _("Tools")) wxglade_tmp_menu = wx.Menu() self.loan_film = wx.MenuItem(wxglade_tmp_menu, 22, _("Loan"), _("Loans a film"), wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.loan_film) self.return_film = wx.MenuItem(wxglade_tmp_menu, 23, _("Return"), _("Returns a previously loaned film"), wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.return_film) self.email_reminder = wx.MenuItem(wxglade_tmp_menu, 24, _("E-mail reminder"), _("Sends an automatic loan reminder e-mail message "), wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.email_reminder) wxglade_tmp_menu.AppendSeparator() self.people = wx.MenuItem(wxglade_tmp_menu, 25, _("People"), _("Manages people information"), wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.people) self.main_frame_menubar.Append(wxglade_tmp_menu, _("Loans")) wxglade_tmp_menu = wx.Menu() self.homepage = wx.MenuItem(wxglade_tmp_menu, 26, _("Homepage"), _("Visit Griffith's homepage"), wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.homepage) self.forum = wx.MenuItem(wxglade_tmp_menu, 27, _("Forum"), _("Visit Griffith's community forum"), wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.forum) self.reportbug = wx.MenuItem(wxglade_tmp_menu, 28, _("Reportbug"), _("Report a new bug"), wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.reportbug) wxglade_tmp_menu.AppendSeparator() self.about = wx.MenuItem(wxglade_tmp_menu, wx.ID_ABOUT, _("About"), _("Display information about this program"), wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.about) self.main_frame_menubar.Append(wxglade_tmp_menu, _("Help")) self.SetMenuBar(self.main_frame_menubar) # Menu Bar end self.main_frame_statusbar = self.CreateStatusBar(1, 0) # Tool Bar self.main_frame_toolbar = wx.ToolBar(self, -1, style=wx.TB_HORIZONTAL|wx.TB_DOCKABLE|wx.TB_TEXT) self.SetToolBar(self.main_frame_toolbar) self.main_frame_toolbar.AddLabelTool(1004, _("First"), wx.Bitmap("images/go-first.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "", "") self.main_frame_toolbar.AddLabelTool(1003, _("Previous"), wx.Bitmap("images/go-previous.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "", "") self.main_frame_toolbar.AddLabelTool(1004, _("Next"), wx.Bitmap("images/go-next.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "", "") self.main_frame_toolbar.AddLabelTool(1005, _("Last"), wx.Bitmap("images/go-last.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "", "") self.main_frame_toolbar.AddSeparator() self.main_frame_toolbar.AddLabelTool(1006, _("Add"), wx.Bitmap("images/document-new.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, _("Add a new film"), _("Add a new film to the collection")) self.main_frame_toolbar.AddLabelTool(1008, _("Delete"), wx.Bitmap("images/user-trash.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, _("Delete this film"), _("Deletes this film from collection")) self.main_frame_toolbar.AddLabelTool(1009, _("Edit"), wx.Bitmap("images/edit-select-all.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, _("Edit film details"), _("Edit film details")) self.main_frame_toolbar.AddSeparator() self.main_frame_toolbar.AddLabelTool(1010, _("Webpage"), wx.Bitmap("images/applications-internet.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, _("Go to the film webpage"), _("Go to the film webpage")) self.main_frame_toolbar.AddSeparator() self.main_frame_toolbar.AddLabelTool(1013, _("Amazon Poster"), wx.Bitmap("images/applications-graphics.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, _("Add Poster From Amazon"), _("Try to find a poster using the Amazon Services on the web")) self.main_frame_toolbar.AddSeparator() self.main_frame_toolbar.AddLabelTool(1014, _("People"), wx.Bitmap("images/system-users.png", wx.BITMAP_TYPE_ANY), wx.NullBitmap, wx.ITEM_NORMAL, "", "") # Tool Bar end self.label_1 = wx.StaticText(self, -1, _("Filter")) self.tc_filter = wx.TextCtrl(self, -1, "") self.bt_clear_filter = wx.Button(self, -1, _("clear")) self.cb_criteria = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.main_listcontrol = wx.ListCtrl(self.window_1_pane_1, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER) self.number = wx.StaticText(self.window_1_pane_2, -1, _("label_2")) self.o_title = wx.StaticText(self.window_1_pane_2, -1, _("label_2")) self.title = wx.StaticText(self.window_1_pane_2, -1, _("label_2")) self.poster = wx.BitmapButton(self.window_1_pane_2, -1, wx.NullBitmap, style=wx.BU_AUTODRAW) self.plot = wx.TextCtrl(self.notebook_1, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH2|wx.TE_AUTO_URL|wx.TE_LINEWRAP|wx.TE_WORDWRAP) self.cast = wx.TextCtrl(self.notebook_1, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH2|wx.TE_AUTO_URL|wx.TE_LINEWRAP|wx.TE_WORDWRAP) self.notes = wx.TextCtrl(self.notebook_1, -1, "", style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH2|wx.TE_AUTO_URL|wx.TE_LINEWRAP|wx.TE_WORDWRAP) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_MENU, self.OnNew, self.new) self.Bind(wx.EVT_MENU, self.OnSaveAs, self.save_as) self.Bind(wx.EVT_MENU, self.OnRevert, self.revert) self.Bind(wx.EVT_MENU, self.OnImport, self.import_data) self.Bind(wx.EVT_MENU, self.OnExport, self.export_data) self.Bind(wx.EVT_MENU, self.OnPrint, self._print) self.Bind(wx.EVT_MENU, self.OnExit, self.exit) self.Bind(wx.EVT_MENU, self.OnAdd, self.add) self.Bind(wx.EVT_MENU, self.OnDelete, self.delete) self.Bind(wx.EVT_MENU, self.OnEdit, self.edit) self.Bind(wx.EVT_MENU, self.onDuplicate, self.duplicate) self.Bind(wx.EVT_MENU, self.OnPosterOpen, self.open) self.Bind(wx.EVT_MENU, self.OnPosterFromAmazon, self.fetch) self.Bind(wx.EVT_MENU, self.OnPosterErase, self.erase) self.Bind(wx.EVT_MENU, self.OnViewToolbar, self.view_toolbar) self.Bind(wx.EVT_MENU, self.OnViewNotSeen, self.view_not_seen) self.Bind(wx.EVT_MENU, self.OnViewLoaned, self.view_loaned) self.Bind(wx.EVT_MENU, self.OnViewAll, self.view_all) self.Bind(wx.EVT_MENU, self.OnSuggest, self.suggest) self.Bind(wx.EVT_MENU, self.OnPrintCoverBuiltin, self.print_cover_builtin) self.Bind(wx.EVT_MENU, self.OnPrintCoverCustom, self.prints_cover_custom) self.Bind(wx.EVT_MENU, self.OnPreferences, self.preferences) self.Bind(wx.EVT_MENU, self.OnLoanFilm, self.loan_film) self.Bind(wx.EVT_MENU, self.OnReturnFilm, self.return_film) self.Bind(wx.EVT_MENU, self.OnEmailReminder, self.email_reminder) self.Bind(wx.EVT_MENU, self.OnPeople, self.people) self.Bind(wx.EVT_MENU, self.OnHomepage, self.homepage) self.Bind(wx.EVT_MENU, self.OnForum, self.forum) self.Bind(wx.EVT_MENU, self.OnReportBug, self.reportbug) self.Bind(wx.EVT_MENU, self.OnAbout, self.about) self.Bind(wx.EVT_TOOL, self.OnFirst, id=1004) self.Bind(wx.EVT_TOOL, self.OnPrevious, id=1003) self.Bind(wx.EVT_TOOL, self.OnNext, id=1004) self.Bind(wx.EVT_TOOL, self.OnLast, id=1005) self.Bind(wx.EVT_TOOL, self.OnAdd, id=1006) self.Bind(wx.EVT_TOOL, self.OnDelete, id=1008) self.Bind(wx.EVT_TOOL, self.OnEdit, id=1009) self.Bind(wx.EVT_TOOL, self.OnWebpage, id=1010) self.Bind(wx.EVT_TOOL, self.OnAddAmazonPoster, id=1013) self.Bind(wx.EVT_TOOL, self.OnPeople, id=1014) self.Bind(wx.EVT_TEXT, self.OnFilterChange, self.tc_filter) self.Bind(wx.EVT_BUTTON, self.OnClearFilter, self.bt_clear_filter) self.Bind(wx.EVT_TEXT, self.OnChangeCriteria, self.cb_criteria) self.Bind(wx.EVT_LIST_DELETE_ITEM, self.OnMainListDelete, self.main_listcontrol) self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnMainListSelected, self.main_listcontrol) self.Bind(wx.EVT_LIST_COL_CLICK, self.OnMainLColumnClicked, self.main_listcontrol) self.Bind(wx.EVT_BUTTON, self.OnPosterClick, self.poster) # end wxGlade initialize.locations_misc(self) #initialize.toolbar(self) initialize.treeview(self) #initialize.loans_treeview(self) #initialize.lang_treeview(self) initialize.dictionaries(self) initialize.combos(self) #initialize.preferences(self) #initialize.movie_plugins(self) #initialize.export_plugins(self) #initialize.people_treeview(self) #initialize.web_results(self) self.initialized = True #self.restore_state() #self.clear_details() self.populate_treeview()