Translated using Weblate.
[wammu.git] / Wammu / Info.py
blob5886690eb761964f382cd308d06b136f54875ed6
1 # -*- coding: UTF-8 -*-
2 # vim: expandtab sw=4 ts=4 sts=4:
3 '''
4 Wammu - Phone manager
5 Phone information reader
6 '''
7 __author__ = 'Michal Čihař'
8 __email__ = 'michal@cihar.com'
9 __license__ = '''
10 Copyright © 2003 - 2010 Michal Čihař
12 This program is free software; you can redistribute it and/or modify it
13 under the terms of the GNU General Public License version 2 as published by
14 the Free Software Foundation.
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 more details.
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 '''
26 import Wammu.Thread
27 if Wammu.gammu_error == None:
28 import gammu
30 class GetInfo(Wammu.Thread.Thread):
31 def Run(self):
32 self.ShowProgress(0)
34 progress = 12
36 data = []
38 if self.canceled:
39 self.Canceled()
40 return
42 try:
43 Manufacturer = self.sm.GetManufacturer()
44 data.append({'Name': _('Manufacturer'), 'Value': Manufacturer, 'Synced': True})
45 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
46 pass
47 except gammu.GSMError, val:
48 self.ShowError(val[0])
50 if self.canceled:
51 self.Canceled()
52 return
54 self.ShowProgress(1*100/progress)
55 try:
56 Model = self.sm.GetModel()
57 data.append({'Name': _('Model (Gammu identification)'), 'Value': Model[0], 'Synced': True})
58 data.append({'Name': _('Model (real)'), 'Value': Model[1], 'Synced': True})
59 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
60 pass
61 except gammu.GSMError, val:
62 self.ShowError(val[0])
64 if self.canceled:
65 self.Canceled()
66 return
68 self.ShowProgress(2*100/progress)
69 try:
70 Firmware = self.sm.GetFirmware()
71 data.append({'Name': _('Firmware'), 'Value': Firmware[0], 'Synced': True})
72 if Firmware[1] != '':
73 data.append({'Name': _('Firmware date'), 'Value': Firmware[1], 'Synced': True})
74 if Firmware[2] != 0.0:
75 data.append({'Name': _('Firmware (numeric)'), 'Value': str(Firmware[2]), 'Synced': True})
76 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
77 pass
78 except gammu.GSMError, val:
79 self.ShowError(val[0])
81 if self.canceled:
82 self.Canceled()
83 return
85 self.ShowProgress(3*100/progress)
86 try:
87 IMEI = self.sm.GetIMEI()
88 data.append({'Name': _('Serial number (IMEI)'), 'Value': IMEI, 'Synced': True})
89 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
90 pass
91 except gammu.GSMError, val:
92 self.ShowError(val[0])
94 if self.canceled:
95 self.Canceled()
96 return
98 self.ShowProgress(4*100/progress)
99 try:
100 OriginalIMEI = self.sm.GetOriginalIMEI()
101 data.append({'Name': _('Original IMEI'), 'Value': OriginalIMEI, 'Synced': True})
102 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
103 pass
104 except gammu.GSMError, val:
105 self.ShowError(val[0])
107 if self.canceled:
108 self.Canceled()
109 return
111 self.ShowProgress(5*100/progress)
112 try:
113 ProductCode = self.sm.GetProductCode()
114 data.append({'Name': _('Product code'), 'Value': ProductCode, 'Synced': True})
115 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
116 pass
117 except gammu.GSMError, val:
118 self.ShowError(val[0])
120 if self.canceled:
121 self.Canceled()
122 return
124 self.ShowProgress(6*100/progress)
125 try:
126 try:
127 SIMIMSI = self.sm.GetSIMIMSI()
128 except (gammu.ERR_SECURITYERROR):
129 SIMIMSI = _('N/A')
130 data.append({'Name': _('SIM IMSI'), 'Value': SIMIMSI, 'Synced': True})
131 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
132 pass
133 except gammu.GSMError, val:
134 self.ShowError(val[0])
136 if self.canceled:
137 self.Canceled()
138 return
140 self.ShowProgress(7*100/progress)
141 try:
142 try:
143 SMSC = self.sm.GetSMSC()
144 except (gammu.ERR_SECURITYERROR):
145 SMSC = _('N/A')
146 data.append({'Name': _('SMSC'), 'Value': SMSC['Number'], 'Synced': True})
147 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED, gammu.ERR_EMPTY):
148 pass
149 except gammu.GSMError, val:
150 self.ShowError(val[0])
152 if self.canceled:
153 self.Canceled()
154 return
156 self.ShowProgress(8*100/progress)
157 try:
158 info = self.sm.GetHardware()
159 data.append({'Name': _('Hardware'), 'Value': info, 'Synced': True})
160 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
161 pass
162 except gammu.GSMError, val:
163 self.ShowError(val[0])
165 if self.canceled:
166 self.Canceled()
167 return
169 self.ShowProgress(9*100/progress)
170 try:
171 info = self.sm.GetManufactureMonth()
172 data.append({'Name': _('Manufacture month'), 'Value': info, 'Synced': True})
173 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
174 pass
175 except gammu.GSMError, val:
176 self.ShowError(val[0])
178 if self.canceled:
179 self.Canceled()
180 return
182 self.ShowProgress(10*100/progress)
183 try:
184 info = self.sm.GetPPM()
185 data.append({'Name': _('Language packs in phone'), 'Value': info, 'Synced': True})
186 except (gammu.ERR_NOTSUPPORTED, gammu.ERR_NOTIMPLEMENTED):
187 pass
188 except gammu.GSMError, val:
189 self.ShowError(val[0])
191 if self.canceled:
192 self.Canceled()
193 return
195 self.ShowProgress(100)
196 self.SendData(['info','phone'], data)