|
|
Choosing A Webhost: |
[mb-commits] r7317 - picard/trunk/picard: msg#00206audio.musicbrainz.cvs
Author: luks Date: 2006-04-22 23:30:59 +0000 (Sat, 22 Apr 2006) New Revision: 7317 Added: picard/trunk/picard/usercheck.py Modified: picard/trunk/picard/tagger.py Log: Moving the user/donation checking code around. :/ Modified: picard/trunk/picard/tagger.py =================================================================== --- picard/trunk/picard/tagger.py 2006-04-22 22:04:57 UTC (rev 7316) +++ picard/trunk/picard/tagger.py 2006-04-22 23:30:59 UTC (rev 7317) @@ -68,12 +68,12 @@ from tunepimp import tunepimp, metadata, track from musicbrainz2.disc import readDisc, getSubmissionUrl -from musicbrainz2.webservice import Query, WebServiceError, TrackFilter, AuthenticationError, ResourceNotFoundError, ConnectionError from picard import APPNAME, APPVERSION, APPTITLE, VENDORNAME from picard import events, coverartcache, albummanager, util, album, debug, tpmanager, cluster, wpath, cuesheet, playlist, puidmanager from picard.browser import browser, filelookup, launch from picard.ui import mdatapanel, albumpanel, images, dirctrl, options, fileselection, toolbar, coverartpanel, infopanel, nagdialog +from picard.usercheck import UserCheckThread # TODO: Add command line arg support @@ -202,6 +202,7 @@ self.Bind(events.EVT_MATCH_FILES_TO_ALBUM, self.OnMatchFilesToAlbum) self.Bind(events.EVT_MATCH_FILEIDS_TO_ALBUM, self.OnMatchFileIdsToAlbum) self.Bind(events.EVT_SET_STATUS_TEXT, self.onSetStatusText) + self.Bind(events.EVT_SHOW_STARTUP_DIALOGS, self.onShowStartupDialogs) self.refreshDirDict = {} self.dropTargetTrackIdCache = {} @@ -306,7 +307,8 @@ self.albumPanel.setCurrentObject(None) - self.nagCheck = True + userCheck = UserCheckThread(self, self.config) + userCheck.start() # start the callback timer and get things moving self.timer.Start(self.timerDelay) @@ -396,7 +398,7 @@ self.tunePimp.setMinPUIDThreshold(self.config.settingPUIDMatchThreshold) self.tunePimp.setPUIDCollisionThreshold(self.config.settingPUIDCollisionThreshold) if hasattr(self.tunePimp, 'setWinSafeFileNames'): - self.tunePimp.(self.config.settingWinSafeFileNames) + self.tunePimp.setWinSafeFileNames(self.config.settingWinSafeFileNames) self.tunePimp.setMusicDNSClientId("0736ac2cd889ef77f26f6b5e3fb8a09c ") def getPUIDManager(self): @@ -482,7 +484,28 @@ def onSetStatusText(self, event): self.setStatusText(event.text) - + + def onShowStartupDialogs(self, event): + if event.dialogs & event.ACCOUNT: + dlg = wx.MessageDialog(self, _("You have not specified an username and password. In order to contribute data to MusicBrainz, you must have a MusicBrainz account.\n" + "Do you want to create a new account now? If you already have a MusicBrainz account, please enter your user information in the options dialog. "), + _("MusicBrainz account"), wx.YES_NO | wx.NO_DEFAULT | wx.ICON_EXCLAMATION) + if dlg.ShowModal() == wx.ID_YES: + l = launch.Launch(None) + l.launch('http://musicbrainz.org/newlogin.html') + dlg.Destroy() + + if event.dialogs & event.DONATION: + dlg = nagdialog.NagDialog(self) + dlg.ShowModal() + dlg.Destroy() + + if event.dialogs & event.CONNECTION_ERROR: + dlg = wx.MessageDialog(self, _("Couldn't connect to the MusicBrainz server."), + _("Connection error"), wx.OK | wx.ICON_EXCLAMATION) + dlg.ShowModal() + dlg.Destroy() + def OnTimer(self, event): if not wx.USE_UNICODE: @@ -499,43 +522,7 @@ self.albumManager.add(al) self.config.persistOpenAlbums = u'' - if self.nagCheck: - self.nagCheck = False - showAccount = True - showDonation = True - - # Check user account and donation status. - if self.config.settingUserName != u'' and self.config.settingUserPassword != u'': - ws = self.config.getWebService() - q = Query(ws) - try: - user = q.getUserByName(self.config.settingUserName) - showDonation = user.getShowNag() - showAccount = False - except AuthenticationError: - pass - except ConnectionError: - showAccount = False - dlg = wx.MessageDialog(self, _("Couldn't connect to the MusicBrainz server."), _("Connection error"), wx.OK | wx.ICON_EXCLAMATION) - dlg.ShowModal() - dlg.Destroy() - except Exception: - showAccount = False - - if showAccount: - dlg = wx.MessageDialog(self, _("You have not specified an username and password. In order to contribute data to MusicBrainz, you must have a MusicBrainz account.\n" - "Do you want to create a new account now? If you already have a MusicBrainz account, please enter your user information in the options dialog. "), - _("MusicBrainz account"), wx.YES_NO | wx.NO_DEFAULT | wx.ICON_EXCLAMATION) - if dlg.ShowModal() == wx.ID_YES: - l = launch.Launch(None) - l.launch('http://musicbrainz.org/newlogin.html') - dlg.Destroy() - - if showDonation: - dlg = nagdialog.NagDialog(self) - dlg.ShowModal() - dlg.Destroy() - + if self.tunePimp: notificationCount = 0 Added: picard/trunk/picard/usercheck.py
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [mb-commits] r7316 - picard/trunk/picard, root |
|---|---|
| Next by Date: | [mb-commits] r7318 - in mb_server/trunk/htdocs: comp/layout css edit/relationship scripts, root |
| Previous by Thread: | [mb-commits] r7316 - picard/trunk/picard, root |
| Next by Thread: | [mb-commits] r7318 - in mb_server/trunk/htdocs: comp/layout css edit/relationship scripts, root |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |