Ejemplo n.º 1
0
 def add(self):
     self.status.setText('')
     lista = []
     newitem = ''
     self.citytoadd = ''
     self.countrytoadd = ''
     self._idtoadd = ''
     dialog = searchcity.SearchCity(self.accurate_url, self.appid, self)
     dialog.id_signal.connect(self.addcity)
     dialog.city_signal.connect(self.addcity)
     dialog.country_signal.connect(self.addcity)
     if dialog.exec_() == 1:
         newitem = (self.citytoadd + '_' + self.countrytoadd + '_' +
                    self._idtoadd)
         for row in range(self.listWidget.count()):
             lista.append(self.listWidget.item(row).text())
         if newitem in lista:
             self.status.setText(
                 QCoreApplication.translate(
                     'Status bar message',
                     'The city already exists in the list',
                     'Cities list dialogue'))
             return
         else:
             self.listWidget.addItem(newitem)
             self.checklength()
Ejemplo n.º 2
0
 def tempcity(self):
     # Prevent to register a temporary city
     # This happen when a temporary city is still loading
     self.restore_city()
     dialog = searchcity.SearchCity(self.accurate_url, self.appid, self)
     self.id_2, self.city2, self.country2 = (self.settings.value('ID'),
                                             self.settings.value('City'),
                                             self.settings.value('Country'))
     dialog.id_signal[tuple].connect(self.citydata)
     dialog.city_signal[tuple].connect(self.citydata)
     dialog.country_signal[tuple].connect(self.citydata)
     if dialog.exec_():
         self.temporary_city_status = True
         self.systray.setToolTip(self.tr('Fetching weather data...'))
         self.refresh()