Example #1
0
	def saveClicked(self):
		text = unicode(self.regionNameField.toPlainText())
		text = dotlan.convertRegionName(text)
		self.regionNameField.setPlainText(text)
		correct = False
		try:
			url = dotlan.Map.DOTLAN_BASIC_URL.format(text)
			request = urllib2.urlopen(url)
			content = request.read()
			if u"not found" in content:
				correct = False
				# Fallback -> ships vintel with this map?
				try:
					with open(resourcePath("vi/ui/res/mapdata/{0}.svg".format(text))) as _:
						correct = True
				except Exception as e:
					print str(e)
					correct = False
				if not correct:
					QMessageBox.warning(self, u"No such region!", u"I can't find a region called '{0}'".format(text))
			else:
				correct = True
		except Exception as e:
			QMessageBox.critical(self, u"Something went wrong!", u"Error while testing existing '{0}'".format(str(e)))
			print str(e)
			correct = False
		if correct:
			Cache().putIntoCache("region_name", text, 60 * 60 * 24 * 365)
			self.accept()
			self.emit(Qt.SIGNAL("new_region_chosen"))
Example #2
0
 def saveClicked(self):
     text = six.text_type(self.regionNameField.toPlainText())
     text = dotlan.convertRegionName(text)
     self.regionNameField.setPlainText(text)
     correct = False
     try:
         url = dotlan.Map.DOTLAN_BASIC_URL.format(text)
         content = requests.get(url).text
         if u"not found" in content:
             correct = False
             # Fallback -> ships vintel with this map?
             try:
                 with open(resourcePath("vi/ui/res/mapdata/{0}.svg".format(text))) as _:
                     correct = True
             except Exception as e:
                 logging.error(e)
                 correct = False
             if not correct:
                 QMessageBox.warning(self, u"No such region!", u"I can't find a region called '{0}'".format(text))
         else:
             correct = True
     except Exception as e:
         QMessageBox.critical(self, u"Something went wrong!", u"Error while testing existing '{0}'".format(str(e)))
         logging.error(e)
         correct = False
     if correct:
         Cache().putIntoCache("region_name", text, 60 * 60 * 24 * 365)
         self.accept()
         self.emit(SIGNAL("new_region_chosen"))
Example #3
0
	def handleRegionMenuItemSelected(self, menuAction=None):
		self.catchRegionAction.setChecked(False)
		self.providenceRegionAction.setChecked(False)
		self.providenceCatchRegionAction.setChecked(False)
		self.chooseRegionAction.setChecked(False)
		if menuAction:
			menuAction.setChecked(True)
			regionName = unicode(menuAction.property("regionName").toString())
			regionName = dotlan.convertRegionName(regionName)
			Cache().putIntoCache("region_name", regionName, 60 * 60 * 24 * 365)
			self.setupMap()
Example #4
0
 def handleRegionMenuItemSelected(self, menuAction=None):
     self.catchRegionAction.setChecked(False)
     self.providenceRegionAction.setChecked(False)
     self.queriousRegionAction.setChecked(False)
     self.providenceCatchRegionAction.setChecked(False)
     self.providenceCatchCompactRegionAction.setChecked(False)
     self.chooseRegionAction.setChecked(False)
     if menuAction:
         menuAction.setChecked(True)
         regionName = six.text_type(menuAction.property("regionName").toString())
         regionName = dotlan.convertRegionName(regionName)
         Cache().putIntoCache("region_name", regionName, 60 * 60 * 24 * 365)
         self.setupMap()