Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.0.1, 2.0.2, and 2.0.3

stable about: move functionality of AboutUpdateThread to AboutDialog

Changeset 31c5f64b51a2

Parent 7c13fe1529de

by Yuya Nishihara

Changes to one file · Browse files at 31c5f64b51a2 Showing diff from parent 7c13fe1529de Diff from another changeset...

 
100
101
102
 
103
104
105
 
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
 
157
158
159
160
161
162
163
164
165
166
167
168
169
170
 
171
172
173
 
174
175
176
 
199
200
201
202
203
 
 
204
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
206
207
 
100
101
102
103
104
105
106
 
120
121
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
124
125
126
 
 
 
 
 
127
 
 
 
 
 
128
129
130
 
131
132
133
134
 
157
158
159
 
 
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
@@ -100,6 +100,7 @@
    # Spawn it later, so that the dialog gets visible quickly.   QTimer.singleShot(0, self.getUpdateInfo) + self._newverreply = None     def getVersionInfo(self):   def make_version(tuple): @@ -119,58 +120,15 @@
    @pyqtSlot()   def getUpdateInfo(self): - self.uthread = AboutUpdateThread(self) - self.uthread.finished.connect(self.uFinished) - self.uthread.start() - - def uFinished(self): - urldata = self.uthread.urldata - if urldata: - self.download_url_lbl.setText(urldata) - - def showLicense(self): - from tortoisehg.hgqt import license - ld = license.LicenseDialog(self) - ld.show() - - def closeEvent(self, event): - if self.uthread: - self.uthread.abort() - self._writesettings() - super(AboutDialog, self).closeEvent(event) - - def _readsettings(self): - s = QSettings() - self.restoreGeometry(s.value('about/geom').toByteArray()) - - def _writesettings(self): - s = QSettings() - s.setValue('about/geom', self.saveGeometry()) - - -class AboutUpdateThread(QObject): - 'Background thread for getting update info' - finished = pyqtSignal() - - def __init__(self, parent=None): - super(AboutUpdateThread, self).__init__(parent) + verurl = 'http://tortoisehg.bitbucket.org/curversion.txt'   # If we use QNetworkAcessManager elsewhere, it should be shared   # through the application.   self._netmanager = QNetworkAccessManager(self) - - urldata = '' - - def start(self): - verurl = 'http://tortoisehg.bitbucket.org/curversion.txt'   self._newverreply = self._netmanager.get(QNetworkRequest(QUrl(verurl))) - self._newverreply.finished.connect(self._handlenewverreply) - - def abort(self): - if self._newverreply: - self._newverreply.abort() + self._newverreply.finished.connect(self.uFinished)     @pyqtSlot() - def _handlenewverreply(self): + def uFinished(self):   newver = (0,0,0)   try:   f = self._newverreply.readAll().data().splitlines() @@ -199,9 +157,27 @@
  curver = (0,0,0)   if newver > curver:   url_lbl = _('A new version of TortoiseHg is ready for download!') - self.urldata = ('<a href=%s>%s</a>' % (upgradeurl, url_lbl)) - self.finished.emit() + urldata = ('<a href=%s>%s</a>' % (upgradeurl, url_lbl)) + self.download_url_lbl.setText(urldata)   + def showLicense(self): + from tortoisehg.hgqt import license + ld = license.LicenseDialog(self) + ld.show() + + def closeEvent(self, event): + if self._newverreply: + self._newverreply.abort() + self._writesettings() + super(AboutDialog, self).closeEvent(event) + + def _readsettings(self): + s = QSettings() + self.restoreGeometry(s.value('about/geom').toByteArray()) + + def _writesettings(self): + s = QSettings() + s.setValue('about/geom', self.saveGeometry())    def run(ui, *pats, **opts):   return AboutDialog()