def showInfo(self): infoDialog = QtGui.QDialog(self) uic.loadUi(resourcePath("vi/ui/Info.ui"), infoDialog) infoDialog.versionLabel.setText(u"Version: {0}".format(VERSION)) infoDialog.logoLabel.setPixmap(QtGui.QPixmap(resourcePath("vi/ui/res/logo.png"))) infoDialog.connect(infoDialog.closeButton, Qt.SIGNAL("clicked()"), infoDialog.accept) infoDialog.show()
def showInfo(self): infoDialog = QtGui.QDialog(self) uic.loadUi(resourcePath("vi/ui/Info.ui"), infoDialog) infoDialog.versionLabel.setText(u"Version: {0}".format(vi.version.VERSION)) infoDialog.logoLabel.setPixmap(QtGui.QPixmap(resourcePath("vi/ui/res/logo.png"))) infoDialog.connect(infoDialog.closeButton, SIGNAL("clicked()"), infoDialog.accept) infoDialog.show()
def __init__(self): try: # default theme with open( resourcePath( os.path.join("vi", "ui", "res", "styles", "light.css"))) as default: Styles.defaultStyle = default.read() with open( resourcePath( os.path.join("vi", "ui", "res", "styles", "light.yaml"))) as default: Styles.defaultCommons = yaml.full_load(default) default = None # dark theme with open( resourcePath( os.path.join("vi", "ui", "res", "styles", "abyss.css"))) as dark: Styles.darkStyle = dark.read() with open( resourcePath( os.path.join("vi", "ui", "res", "styles", "abyss.yaml"))) as dark: Styles.darkCommons = yaml.full_load(dark) dark = None except Exception as e: logging.critical(e)
def __init__(self, parent, url): QtGui.QDialog.__init__(self, parent) uic.loadUi(resourcePath("vi/ui/JumpbridgeChooser.ui"), self) self.connect(self.saveButton, SIGNAL("clicked()"), self.savePath) self.connect(self.cancelButton, SIGNAL("clicked()"), self.accept) self.urlField.setText(url) # loading format explanation from textfile with open(resourcePath("docs/jumpbridgeformat.txt")) as f: self.formatInfoField.setPlainText(f.read())
def __init__(self, parent, url): QtGui.QDialog.__init__(self, parent) uic.loadUi(resourcePath("vi/ui/JumpbridgeChooser.ui"), self) self.connect(self.saveButton, Qt.SIGNAL("clicked()"), self.savePath) self.connect(self.cancelButton, Qt.SIGNAL("clicked()"), self.accept) self.urlField.setText(url) # loading format explanation from textfile with open(resourcePath("docs/jumpbridgeformat.txt")) as f: self.formatInfoField.setPlainText(f.read())
def __init__(self, message): QtGui.QWidget.__init__(self) if not self.questionMarkPixmap: self.questionMarkPixmap = QtGui.QPixmap(resourcePath("vi/ui/res/qmark.png")).scaledToHeight(32) uic.loadUi(resourcePath("vi/ui/ChatEntry.ui"), self) self.avatarLabel.setPixmap(self.questionMarkPixmap) self.message = message self.updateText() self.changeFontSize(ChatEntryWidget.TEXT_SIZE) self.connect(self.textLabel, SIGNAL("linkActivated(QString)"), self.linkClicked) if not ChatEntryWidget.SHOW_AVATAR: self.avatarLabel.setVisible(False)
def __init__(self, message): QtGui.QWidget.__init__(self) if not self.questionMarkPixmap: self.questionMarkPixmap = QtGui.QPixmap(resourcePath("vi/ui/res/qmark.png")) uic.loadUi(resourcePath("vi/ui/ChatEntry.ui"), self) self.avatarLabel.setPixmap(self.questionMarkPixmap) self.message = message self.updateText() self.connect(self.textLabel, QtCore.SIGNAL("linkActivated(QString)"), self.linkClicked) if sys.platform.startswith("win32") or sys.platform.startswith("cygwin"): ChatEntryWidget.TEXT_SIZE = 8 self.changeFontSize(self.TEXT_SIZE) if not ChatEntryWidget.SHOW_AVATAR: self.avatarLabel.setVisible(False)
def __init__(self): # default theme with open(resourcePath("vi/ui/res/styles/light.css")) as default: Styles.defaultStyle = default.read() with open(resourcePath("vi/ui/res/styles/light.yaml")) as default: Styles.defaultCommons = yaml.load(default) default = None # dark theme with open(resourcePath("vi/ui/res/styles/abyss.css")) as dark: Styles.darkStyle = dark.read() with open(resourcePath("vi/ui/res/styles/abyss.yaml")) as dark: Styles.darkCommons = yaml.load(dark) dark = None
def run(self): cache = Cache() lastCall = 0 wait = 300 # time between 2 requests in ms while True: try: # Block waiting for addChatEntry() to enqueue something chatEntry = self.queue.get() if not self.active: return charname = chatEntry.message.user logging.debug("AvatarFindThread getting avatar for %s" % charname) avatar = None if charname == "VINTEL": with open(resourcePath("vi/ui/res/logo_small.png"), "rb") as f: avatar = f.read() if not avatar: avatar = cache.getAvatar(charname) if avatar: logging.debug("AvatarFindThread found cached avatar for %s" % charname) if not avatar: diffLastCall = time.time() - lastCall if diffLastCall < wait: time.sleep((wait - diffLastCall) / 1000.0) avatar = evegate.getAvatarForPlayer(charname) lastCall = time.time() if avatar: cache.putAvatar(charname, avatar) if avatar: logging.debug("AvatarFindThread emit avatar_update for %s" % charname) self.emit(SIGNAL("avatar_update"), chatEntry, avatar) except Exception as e: logging.error("Error in AvatarFindThread : %s", e)
def run(self): cache = Cache() lastCall = 0 wait = 300 # time between 2 requests in ms while True: try: # Block waiting for addChatEntry() to enqueue something chatEntry = self.queue.get() charname = chatEntry.message.user avatar = None if charname == "VINTEL": with open(resourcePath("vi/ui/res/logo_small.png"), "rb") as f: avatar = f.read() if not avatar: avatar = cache.getAvatar(charname) if not avatar: diffLastCall = time.time() - lastCall if diffLastCall < wait: time.sleep((wait - diffLastCall) / 1000.0) avatar = evegate.getAvatarForPlayer(charname) lastCall = time.time() if avatar: cache.putAvatar(charname, avatar) if avatar: self.emit(SIGNAL("avatar_update"), chatEntry, avatar) except Exception as e: print "An error in the AvatarFindThread : {0}".format(str(e))
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"))
def __init__(self, parent, chatType, selector, chatEntries, knownPlayerNames): QtGui.QDialog.__init__(self, parent) uic.loadUi(resourcePath("vi/ui/SystemChat.ui"), self) self.parent = parent self.chatType = 0 self.selector = selector self.chatEntries = [] for entry in chatEntries: self.addChatEntry(entry) titleName = "" if self.chatType == SystemChat.SYSTEM: titleName = self.selector.name self.system = selector for name in knownPlayerNames: self.playerNamesBox.addItem(name) self.setWindowTitle("Chat for {0}".format(titleName)) self.connect(self.closeButton, Qt.SIGNAL("clicked()"), self.closeDialog) self.connect(self.alarmButton, Qt.SIGNAL("clicked()"), self.setSystemAlarm) self.connect(self.clearButton, Qt.SIGNAL("clicked()"), self.setSystemClear) self.connect(self.locationButton, Qt.SIGNAL("clicked()"), self.locationSet)
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"))
def setupMap(self, initialize=False): self.mapTimer.stop() regionName = self.cache.getFromCache("region_name") if not regionName: regionName = "Providence" svg = None try: with open(resourcePath("vi/ui/res/mapdata/{0}.svg".format(regionName))) as svgFile: svg = svgFile.read() except Exception as e: pass try: self.dotlan = dotlan.Map(regionName, svg) except dotlan.DotlanException as e: QtGui.QMessageBox.critical(None, "Error getting map", unicode(e), "Quit") sys.exit(1) if self.dotlan.outdatedCacheError: e = self.dotlan.outdatedCacheError diagText = "Something went wrong getting map data. Proceeding with older cached data. " \ "Check for a newer version and inform the maintainer.\n\nError: {0} {1}".format(type(e), unicode(e)) print str(e) QtGui.QMessageBox.warning(None, "Using map from cache", diagText, "Ok") # Load the jumpbridges self.setJumpbridges(self.cache.getFromCache("jumpbridge_url")) self.initMapPosition = None # We read this after first rendering self.systems = self.dotlan.systems self.chatparser = chatparser.ChatParser(self.pathToLogs, self.roomnames, self.systems) # Menus - only once if initialize: # Add a contextual menu to the mapView def mapContextMenuEvent(event): self.mapView.contextMenu.exec_(self.mapToGlobal(QPoint(event.x(), event.y()))) self.setMapContent(self.dotlan.svg) self.mapView.contextMenu = TrayContextMenu(self.trayIcon) self.mapView.contextMenuEvent = mapContextMenuEvent self.mapView.connect(self.mapView, Qt.SIGNAL("linkClicked(const QUrl&)"), self.mapLinkClicked) # Also set up our app menus regionName = self.cache.getFromCache("region_name") if not regionName: self.providenceRegionAction.setChecked(True) elif regionName.startswith("Providencecatch"): self.providenceCatchRegionAction.setChecked(True) elif regionName.startswith("Catch"): self.catchRegionAction.setChecked(True) elif regionName.startswith("Providence"): self.providenceRegionAction.setChecked(True) else: self.chooseRegionAction.setChecked(True) self.updateMapView(force=True) self.mapTimer.start(MAP_UPDATE_INTERVAL_IN_MSECS) self.jumpbridgesButton.setChecked(False) self.statisticsButton.setChecked(False)
def showSoundSetup(self): dialog = QtGui.QDialog(self) uic.loadUi(resourcePath("vi/ui/SoundSetup.ui"), dialog) dialog.volumeSlider.setValue(SoundManager().soundVolume) dialog.connect(dialog.volumeSlider, SIGNAL("valueChanged(int)"), SoundManager().setSoundVolume) dialog.connect(dialog.testSoundButton, SIGNAL("clicked()"), SoundManager().playSound) dialog.connect(dialog.closeButton, SIGNAL("clicked()"), dialog.accept) dialog.show()
def showSoundSetup(self): dialog = QtGui.QDialog(self) uic.loadUi(resourcePath("vi/ui/SoundSetup.ui"), dialog) dialog.volumeSlider.setValue(SoundManager().soundVolume) dialog.connect(dialog.volumeSlider, Qt.SIGNAL("valueChanged(int)"), SoundManager().setSoundVolume) dialog.connect(dialog.testSoundButton, Qt.SIGNAL("clicked()"), SoundManager().playSound) dialog.connect(dialog.closeButton, Qt.SIGNAL("clicked()"), dialog.accept) dialog.show()
def __init__(self, message): QtGui.QWidget.__init__(self) if not self.questionMarkPixmap: self.questionMarkPixmap = QtGui.QPixmap( resourcePath("vi/ui/res/qmark.png")) uic.loadUi(resourcePath("vi/ui/ChatEntry.ui"), self) self.avatarLabel.setPixmap(self.questionMarkPixmap) self.message = message self.updateText() self.connect(self.textLabel, QtCore.SIGNAL("linkActivated(QString)"), self.linkClicked) if sys.platform.startswith("win32") or sys.platform.startswith( "cygwin"): ChatEntryWidget.TEXT_SIZE = 8 self.changeFontSize(self.TEXT_SIZE) if not ChatEntryWidget.SHOW_AVATAR: self.avatarLabel.setVisible(False)
def __init__(self, app): self.icon = QtGui.QIcon(resourcePath("vi/ui/res/logo_small.png")) QtGui.QSystemTrayIcon.__init__(self, self.icon, app) self.setToolTip("Your Vintel-Information-Service! :)") self.lastNotifications = {} self.setContextMenu(TrayContextMenu(self)) self.showAlarm = True self.showRequest = True self.alarmDistance = 0
def __init__(self, app): self.icon = QIcon(resourcePath("vi/ui/res/logo_small.png")) QSystemTrayIcon.__init__(self, self.icon, app) self.setToolTip("RC Vintel") self.lastNotifications = {} self.setContextMenu(TrayContextMenu(self)) self.showAlarm = True self.showRequest = True self.alarmDistance = 0
def __init__(self, parent): QtGui.QDialog.__init__(self, parent) uic.loadUi(resourcePath("vi/ui/RegionChooser.ui"), self) self.connect(self.cancelButton, Qt.SIGNAL("clicked()"), self.accept) self.connect(self.saveButton, Qt.SIGNAL("clicked()"), self.saveClicked) cache = Cache() regionName = cache.getFromCache("region_name") if not regionName: regionName = u"Providence" self.regionNameField.setPlainText(regionName)
def __init__(self, parent): QtGui.QDialog.__init__(self, parent) uic.loadUi(resourcePath("vi/ui/RegionChooser.ui"), self) self.connect(self.cancelButton, SIGNAL("clicked()"), self.accept) self.connect(self.saveButton, SIGNAL("clicked()"), self.saveClicked) cache = Cache() regionName = cache.getFromCache("region_name") if not regionName: regionName = u"Providence" self.regionNameField.setPlainText(regionName)
def __init__(self, parent): QtGui.QDialog.__init__(self, parent) uic.loadUi(resourcePath("vi/ui/ChatroomsChooser.ui"), self) self.connect(self.defaultButton, SIGNAL("clicked()"), self.setDefaults) self.connect(self.cancelButton, SIGNAL("clicked()"), self.accept) self.connect(self.saveButton, SIGNAL("clicked()"), self.saveClicked) cache = Cache() roomnames = cache.getFromCache("room_names") if not roomnames: roomnames = u"TheCitadel,North Provi Intel,4THINTEL" self.roomnamesField.setPlainText(roomnames)
def __init__(self, parent): QtGui.QDialog.__init__(self, parent) uic.loadUi(resourcePath("vi/ui/ChatroomsChooser.ui"), self) self.connect(self.defaultButton, Qt.SIGNAL("clicked()"), self.setDefaults) self.connect(self.cancelButton, Qt.SIGNAL("clicked()"), self.accept) self.connect(self.saveButton, Qt.SIGNAL("clicked()"), self.saveClicked) cache = Cache() roomnames = cache.getFromCache("room_names") if not roomnames: roomnames = u"TheCitadel,North Provi Intel,North Catch Intel" self.roomnamesField.setPlainText(roomnames)
def __init__(self, app): self.icon = QIcon( resourcePath(os.path.join("vi", "ui", "res", "logo_small.png")) ) QSystemTrayIcon.__init__(self, self.icon, app) self.setToolTip("Your Spyglass Information Service! :)") self.lastNotifications = {} self.setContextMenu(TrayContextMenu(self)) self.showAlarm = True self.showRequest = True self.alarmDistance = 0
def run(self): cache = Cache() lastCall = 0 wait = 500 # time between 2 requests in ms while True: try: # Block waiting for addChatEntry() to enqueue something chatEntry = self.queue.get() if not self.active: return charname = chatEntry.message.user logging.debug("AvatarFindThread getting avatar for %s" % charname) avatar = None if charname == "SPYGLASS": with open( resourcePath( os.path.join("vi", "ui", "res", "logo_small.png")), "rb", ) as f: avatar = f.read() if avatar is None: avatar = cache.getAvatar(charname) if avatar: logging.debug( "AvatarFindThread found cached avatar for %s" % charname) if avatar is None: diffLastCall = time.time() - lastCall if diffLastCall < wait: time.sleep((wait - diffLastCall) / 1000.0) avatar = evegate.getAvatarForPlayer(charname) lastCall = time.time() if avatar is None: cache.removeAvatar(charname) else: cache.putAvatar(charname, avatar) if avatar: logging.debug( "AvatarFindThread emit avatar_update for %s" % charname) self.avatar_update.emit(chatEntry, avatar) else: logging.warning( "AvatarFindThread unable to find avatar for %s" % charname) except Exception as e: logging.error("Error in AvatarFindThread : %s", e)
def run(self): print("Running Avatar Find Thread") cache = Cache() lastCall = 0 wait = 300 # time between 2 requests in ms while True: try: # Block waiting for addChatEntry() to enqueue something chatEntry = self.queue.get() if not self.active: return charname = chatEntry.message.user logging.debug("AvatarFindThread getting avatar for %s" % charname) avatar = None if charname == "SPYGLASS": with open(resourcePath("vi/ui/res/logo_small.png"), "rb") as f: avatar = f.read() if not avatar: avatar = cache.getAvatar(charname) if avatar: logging.debug( "AvatarFindThread found cached avatar for %s" % charname) if not avatar: diffLastCall = time.time() - lastCall if diffLastCall < wait: time.sleep((wait - diffLastCall) / 1000.0) avatar = evegate.getAvatarForPlayer(charname) lastCall = time.time() if avatar: cache.putAvatar(charname, avatar) if avatar: logging.debug( "AvatarFindThread emit avatar_update for %s" % charname) self.emit(SIGNAL("avatar_update"), chatEntry, avatar) except Exception as e: logging.error("Error in AvatarFindThread : %s", e)
# Setting local directory for cache and logging vintelDirectory = os.path.join( os.path.dirname(os.path.dirname(chatLogDirectory)), "vintel") if not os.path.exists(vintelDirectory): os.mkdir(vintelDirectory) cache.Cache.PATH_TO_CACHE = os.path.join(vintelDirectory, "cache-2.sqlite3") vintelLogDirectory = os.path.join(vintelDirectory, "logs") if not os.path.exists(vintelLogDirectory): os.mkdir(vintelLogDirectory) # Setup the application object, display splash screen app = QtGui.QApplication(sys.argv) splash = QtGui.QSplashScreen( QtGui.QPixmap(resourcePath("vi/ui/res/logo.png"))) vintelCache = Cache() logLevel = vintelCache.getFromCache("logging_level") if not logLevel: logLevel = logging.WARN backGroundColor = vintelCache.getFromCache("background_color") if backGroundColor: app.setStyleSheet("QWidget { background-color: %s; }" % backGroundColor) splash.show() app.processEvents() # Setup logging for console and rotated log files formatter = logging.Formatter('%(asctime)s| %(message)s',
def setupMap(self, initialize=False): self.mapTimer.stop() self.filewatcherThread.paused = True logging.info("Finding map file") regionName = self.cache.getFromCache("region_name") if not regionName: regionName = "Providence" svg = None try: with open(resourcePath("vi/ui/res/mapdata/{0}.svg".format(regionName))) as svgFile: svg = svgFile.read() except Exception as e: pass try: self.dotlan = dotlan.Map(regionName, svg) except dotlan.DotlanException as e: logging.error(e) QtGui.QMessageBox.critical(None, "Error getting map", six.text_type(e), "Quit") sys.exit(1) if self.dotlan.outdatedCacheError: e = self.dotlan.outdatedCacheError diagText = "Something went wrong getting map data. Proceeding with older cached data. " \ "Check for a newer version and inform the maintainer.\n\nError: {0} {1}".format(type(e), six.text_type(e)) logging.warn(diagText) QtGui.QMessageBox.warning(None, "Using map from cache", diagText, "Ok") # Load the jumpbridges logging.critical("Load jump bridges") self.setJumpbridges(self.cache.getFromCache("jumpbridge_url")) self.systems = self.dotlan.systems logging.critical("Creating chat parser") self.chatparser = chatparser.ChatParser(self.pathToLogs, self.roomnames, self.systems) # Menus - only once if initialize: logging.critical("Initializing contextual menus") # Add a contextual menu to the mapView def mapContextMenuEvent(event): #if QApplication.activeWindow() or QApplication.focusWidget(): self.mapView.contextMenu.exec_(self.mapToGlobal(QPoint(event.x(), event.y()))) self.mapView.contextMenuEvent = mapContextMenuEvent self.mapView.contextMenu = self.trayIcon.contextMenu() # Clicking links self.mapView.connect(self.mapView, Qt.SIGNAL("linkClicked(const QUrl&)"), self.mapLinkClicked) # Also set up our app menus if not regionName: self.providenceCatchRegionAction.setChecked(True) elif regionName.startswith("Providencecatch"): self.providenceCatchRegionAction.setChecked(True) elif regionName.startswith("Catch"): self.catchRegionAction.setChecked(True) elif regionName.startswith("Providence"): self.providenceRegionAction.setChecked(True) elif regionName.startswith("Querious"): self.queriousRegionAction.setChecked(True) else: self.chooseRegionAction.setChecked(True) self.jumpbridgesButton.setChecked(False) self.statisticsButton.setChecked(False) # Update the new map view, then clear old statistics from the map and request new logging.critical("Updating the map") self.updateMapView() self.setInitialMapPositionForRegion(regionName) self.mapTimer.start(MAP_UPDATE_INTERVAL_MSECS) # Allow the file watcher to run now that all else is set up self.filewatcherThread.paused = False logging.critical("Map setup complete")
def __init__(self, pathToLogs, trayIcon, backGroundColor): QtGui.QMainWindow.__init__(self) self.cache = Cache() if backGroundColor: self.setStyleSheet("QWidget { background-color: %s; }" % backGroundColor) uic.loadUi(resourcePath('vi/ui/MainWindow.ui'), self) self.setWindowTitle("Vintel " + vi.version.VERSION + "{dev}".format(dev="-SNAPSHOT" if vi.version.SNAPSHOT else "")) self.taskbarIconQuiescent = QtGui.QIcon(resourcePath("vi/ui/res/logo_small.png")) self.taskbarIconWorking = QtGui.QIcon(resourcePath("vi/ui/res/logo_small_green.png")) self.setWindowIcon(self.taskbarIconQuiescent) self.setFocusPolicy(QtCore.Qt.StrongFocus) self.pathToLogs = pathToLogs self.mapTimer = QtCore.QTimer(self) self.connect(self.mapTimer, QtCore.SIGNAL("timeout()"), self.updateMapView) self.clipboardTimer = QtCore.QTimer(self) self.oldClipboardContent = "" self.trayIcon = trayIcon self.trayIcon.activated.connect(self.systemTrayActivated) self.clipboard = QtGui.QApplication.clipboard() self.clipboard.clear(mode=self.clipboard.Clipboard) self.alarmDistance = 0 self.lastStatisticsUpdate = 0 self.chatEntries = [] self.frameButton.setVisible(False) self.scanIntelForKosRequestsEnabled = True self.initialMapPosition = None self.mapPositionsDict = {} # Load user's toon names self.knownPlayerNames = self.cache.getFromCache("known_player_names") if self.knownPlayerNames: self.knownPlayerNames = set(self.knownPlayerNames.split(",")) else: self.knownPlayerNames = set() diagText = "Vintel scans EVE system logs and remembers your characters as they change systems.\n\nSome features (clipboard KOS checking, alarms, etc.) may not work until your character(s) have been registered. Change systems, with each character you want to monitor, while Vintel is running to remedy this." QtGui.QMessageBox.warning(None, "Known Characters not Found", diagText, "Ok") # Set up user's intel rooms roomnames = self.cache.getFromCache("room_names") if roomnames: roomnames = roomnames.split(",") else: roomnames = (u"TheCitadel", u"North Provi Intel", u"North Catch Intel", "North Querious Intel") self.cache.putIntoCache("room_names", u",".join(roomnames), 60 * 60 * 24 * 365 * 5) self.roomnames = roomnames # Disable the sound UI if sound is not available if not SoundManager().soundAvailable: self.changeSound(disable=True) else: self.changeSound() # Set up Transparency menu - fill in opacity values and make connections self.opacityGroup = QtGui.QActionGroup(self.menu) for i in (100, 80, 60, 40, 20): action = QtGui.QAction("Opacity {0}%".format(i), None, checkable=True) if i == 100: action.setChecked(True) action.opacity = i / 100.0 self.connect(action, QtCore.SIGNAL("triggered()"), self.changeOpacity) self.opacityGroup.addAction(action) self.menuTransparency.addAction(action) # # Platform specific UI resizing - we size items in the resource files to look correct on the mac, # then resize other platforms as needed # if sys.platform.startswith("win32") or sys.platform.startswith("cygwin"): font = self.statisticsButton.font() font.setPointSize(8) self.statisticsButton.setFont(font) self.jumpbridgesButton.setFont(font) elif sys.platform.startswith("linux"): pass self.wireUpUIConnections() self.recallCachedSettings() self.setupThreads() self.setupMap(True)
def __init__(self, pathToLogs, trayIcon, backGroundColor): QtGui.QMainWindow.__init__(self) self.cache = Cache() if backGroundColor: self.setStyleSheet("QWidget { background-color: %s; }" % backGroundColor) uic.loadUi(resourcePath('vi/ui/MainWindow.ui'), self) self.setWindowTitle( "Spyglass " + vi.version.VERSION + "{dev}".format(dev="-SNAPSHOT" if vi.version.SNAPSHOT else "")) self.taskbarIconQuiescent = QtGui.QIcon(resourcePath("vi/ui/res/logo_small.png")) self.taskbarIconWorking = QtGui.QIcon(resourcePath("vi/ui/res/logo_small_green.png")) self.setWindowIcon(self.taskbarIconQuiescent) self.setFocusPolicy(QtCore.Qt.StrongFocus) self.pathToLogs = pathToLogs self.mapTimer = QtCore.QTimer(self) self.connect(self.mapTimer, SIGNAL("timeout()"), self.updateMapView) self.clipboardTimer = QtCore.QTimer(self) self.oldClipboardContent = "" self.trayIcon = trayIcon self.trayIcon.activated.connect(self.systemTrayActivated) self.clipboard = QtGui.QApplication.clipboard() self.clipboard.clear(mode=self.clipboard.Clipboard) self.alarmDistance = 0 self.lastStatisticsUpdate = 0 self.chatEntries = [] self.frameButton.setVisible(False) self.scanIntelForKosRequestsEnabled = True self.initialMapPosition = None self.mapPositionsDict = {} self.autoRescanIntelEnabled = self.cache.getFromCache("changeAutoRescanIntel") # Load user's toon names self.knownPlayerNames = self.cache.getFromCache("known_player_names") if self.knownPlayerNames: self.knownPlayerNames = set(self.knownPlayerNames.split(",")) else: self.knownPlayerNames = set() diagText = "Spyglass scans EVE system logs and remembers your characters as they change systems.\n\nSome features (clipboard KOS checking, alarms, etc.) may not work until your character(s) have been registered. Change systems, with each character you want to monitor, while Spyglass is running to remedy this." QMessageBox.warning(None, "Known Characters not Found", diagText, "Ok") # Set up user's intel rooms roomnames = self.cache.getFromCache("room_names") if roomnames: roomnames = roomnames.split(",") else: roomnames = (u"TheCitadel", u"North Provi Intel", u"4THINTEL") self.cache.putIntoCache("room_names", u",".join(roomnames), 60 * 60 * 24 * 365 * 5) self.roomnames = roomnames # Disable the sound UI if sound is not available if not SoundManager().soundAvailable: self.changeSound(disable=True) else: self.changeSound() # Set up Transparency menu - fill in opacity values and make connections self.opacityGroup = QActionGroup(self.menu) for i in (100, 80, 60, 40, 20): action = QAction("Opacity {0}%".format(i), None, checkable=True) if i == 100: action.setChecked(True) action.opacity = i / 100.0 self.connect(action, SIGNAL("triggered()"), self.changeOpacity) self.opacityGroup.addAction(action) self.menuTransparency.addAction(action) # Set up Theme menu - fill in list of themes and add connections self.themeGroup = QActionGroup(self.menu) styles = Styles() for theme in styles.getStyles(): action = QAction(theme, None, checkable=True) action.theme = theme if action.theme == "default": action.setChecked(True) logging.info("Adding theme {}".format(theme)) self.connect(action, SIGNAL("triggered()"), self.changeTheme) self.themeGroup.addAction(action) self.menuTheme.addAction(action) styles = None # # Platform specific UI resizing - we size items in the resource files to look correct on the mac, # then resize other platforms as needed # if sys.platform.startswith("win32") or sys.platform.startswith("cygwin"): font = self.statisticsButton.font() font.setPointSize(8) self.statisticsButton.setFont(font) self.jumpbridgesButton.setFont(font) elif sys.platform.startswith("linux"): pass self.wireUpUIConnections() self.recallCachedSettings() self.setupThreads() self.setupMap(True) initialTheme = self.cache.getFromCache("theme") if initialTheme: self.changeTheme(initialTheme)
def __init__(self, args): super(Application, self).__init__(args) # Set up paths chatLogDirectory = "" if len(sys.argv) > 1: chatLogDirectory = sys.argv[1] if not os.path.exists(chatLogDirectory): if sys.platform.startswith("darwin"): chatLogDirectory = os.path.join(os.path.expanduser("~"), "Documents", "EVE", "logs", "Chatlogs") if not os.path.exists(chatLogDirectory): chatLogDirectory = os.path.join(os.path.expanduser("~"), "Library", "Application Support", "Eve Online", "p_drive", "User", "My Documents", "EVE", "logs", "Chatlogs") elif sys.platform.startswith("linux"): chatLogDirectory = os.path.join(os.path.expanduser("~"), "EVE", "logs", "Chatlogs") elif sys.platform.startswith("win32") or sys.platform.startswith( "cygwin"): import ctypes.wintypes buf = ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH) ctypes.windll.shell32.SHGetFolderPathW(0, 5, 0, 0, buf) documentsPath = buf.value chatLogDirectory = os.path.join(documentsPath, "EVE", "logs", "Chatlogs") if not os.path.exists(chatLogDirectory): # None of the paths for logs exist, bailing out QMessageBox.critical(None, "No path to Logs", "No logs found at: " + chatLogDirectory, "Quit") sys.exit(1) # Setting local directory for cache and logging vintelDirectory = os.path.join( os.path.dirname(os.path.dirname(chatLogDirectory)), "vintel") if not os.path.exists(vintelDirectory): os.mkdir(vintelDirectory) cache.Cache.PATH_TO_CACHE = os.path.join(vintelDirectory, "cache-2.sqlite3") vintelLogDirectory = os.path.join(vintelDirectory, "logs") if not os.path.exists(vintelLogDirectory): os.mkdir(vintelLogDirectory) splash = QtGui.QSplashScreen( QtGui.QPixmap(resourcePath("vi/ui/res/logo.png"))) vintelCache = Cache() logLevel = vintelCache.getFromCache("logging_level") if not logLevel: logLevel = logging.WARN backGroundColor = vintelCache.getFromCache("background_color") if backGroundColor: self.setStyleSheet("QWidget { background-color: %s; }" % backGroundColor) splash.show() self.processEvents() # Setup logging for console and rotated log files formatter = logging.Formatter('%(asctime)s| %(message)s', datefmt='%m/%d %I:%M:%S') rootLogger = logging.getLogger() rootLogger.setLevel(level=logLevel) logFilename = vintelLogDirectory + "/output.log" fileHandler = RotatingFileHandler(maxBytes=(1048576 * 5), backupCount=7, filename=logFilename, mode='a') fileHandler.setFormatter(formatter) rootLogger.addHandler(fileHandler) consoleHandler = StreamHandler() consoleHandler.setFormatter(formatter) rootLogger.addHandler(consoleHandler) logging.critical("") logging.critical( "------------------- Vintel %s starting up -------------------", version.VERSION) logging.critical("") logging.debug("Looking for chat logs at: %s", chatLogDirectory) logging.debug("Cache maintained here: %s", cache.Cache.PATH_TO_CACHE) logging.debug("Writing logs to: %s", vintelLogDirectory) trayIcon = systemtray.TrayIcon(self) trayIcon.show() self.mainWindow = viui.MainWindow(chatLogDirectory, trayIcon, backGroundColor) self.mainWindow.show() self.mainWindow.raise_() splash.finish(self.mainWindow)
def __init__(self): QtGui.QDockWidget.__init__(self) uic.loadUi(resourcePath('vi/ui/FloatingOverview.ui'), self)
def __init__(self, args): super(Application, self).__init__(args) QtWebEngineQuick.initialize() splash = QtWidgets.QSplashScreen( QtGui.QPixmap(resourcePath("vi/ui/res/logo_splash.png")) ) splash.show() if version.SNAPSHOT: QMessageBox.critical( splash, "Snapshot", "This is a snapshot release... Use as you will...." ) def change_splash_text(txt): if len(txt): splash.showMessage( f" {txt} ...", QtCore.Qt.AlignmentFlag.AlignLeft, QtGui.QColor(0x808000), ) # Set up paths chat_log_directory = "" if len(sys.argv) > 1: chat_log_directory = sys.argv[1] if not os.path.exists(chat_log_directory): change_splash_text("Searching for EVE Logs") if sys.platform.startswith("darwin"): chat_log_directory = os.path.join( os.path.expanduser("~"), "Documents", "EVE", "logs", "Chatlogs" ) if not os.path.exists(chat_log_directory): chat_log_directory = os.path.join( os.path.expanduser("~"), "Library", "Application Support", "Eve Online", "p_drive", "User", "My Documents", "EVE", "logs", "Chatlogs", ) elif sys.platform.startswith("linux"): chat_log_directory = os.path.join( os.path.expanduser("~"), "Documents", "EVE", "logs", "Chatlogs" ) elif sys.platform.startswith("win32") or sys.platform.startswith("cygwin"): import ctypes.wintypes buf = ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH) ctypes.windll.shell32.SHGetFolderPathW(0, 0x05, 0, 0, buf) documents_path = buf.value chat_log_directory = os.path.join( documents_path, "EVE", "logs", "Chatlogs" ) # Now I need to just make sure... Some old pcs could still be on XP if not os.path.exists(chat_log_directory): chat_log_directory = os.path.join( os.path.expanduser("~"), "My Documents", "EVE", "logs", "Chatlogs", ) if not os.path.exists(chat_log_directory): chat_log_directory = QtWidgets.QFileDialog.getExistingDirectory( None, caption="Select EVE Online chat logfiles directory", directory=chat_log_directory, ) if not os.path.exists(chat_log_directory): # None of the paths for logs exist, bailing out QMessageBox.critical( splash, "No path to Logs", "No logs found at: " + chat_log_directory, QMessageBox.Close, ) sys.exit(1) # Setting local directory for cache and logging change_splash_text("Setting Spyglass Directories") spyglass_dir = os.path.join( os.path.dirname(os.path.dirname(chat_log_directory)), "spyglass" ) if not os.path.exists(spyglass_dir): os.mkdir(spyglass_dir) cache.Cache.PATH_TO_CACHE = os.path.join(spyglass_dir, "cache-2.sqlite3") spyglass_log_directory = os.path.join(spyglass_dir, "logs") if not os.path.exists(spyglass_log_directory): os.mkdir(spyglass_log_directory) change_splash_text("Connecting to Cache") spyglass_cache = Cache() log_level = spyglass_cache.getFromCache("logging_level") if not log_level: log_level = logging.WARN if version.SNAPSHOT: log_level = logging.DEBUG # For Testing BACKGROUND_COLOR = spyglass_cache.getFromCache("background_color") if BACKGROUND_COLOR: self.setStyleSheet(f"background-color: {BACKGROUND_COLOR};") css = Styles().getStyle() self.setStyleSheet(css) del css # Setup logging for console and rotated log files formatter = logging.Formatter( "%(asctime)s| %(message)s", datefmt="%m/%d %I:%M:%S" ) root_logger = logging.getLogger() root_logger.setLevel(level=log_level) log_filename = spyglass_log_directory + "/output.log" file_handler = RotatingFileHandler( maxBytes=(1048576 * 5), backupCount=7, filename=log_filename, mode="a" ) file_handler.setFormatter(formatter) root_logger.addHandler(file_handler) console_handler = StreamHandler() console_handler.setFormatter(formatter) root_logger.addHandler(console_handler) logging.critical("") logging.critical( "------------------- Spyglass %s starting up -------------------", version.VERSION, ) logging.critical("") logging.critical(" Looking for chat logs at: %s", chat_log_directory) logging.critical( " Cache maintained here: %s", cache.Cache.PATH_TO_CACHE ) logging.critical(" Writing logs to: %s", spyglass_log_directory) tray_icon = systemtray.TrayIcon(self) tray_icon.show() self.main_window = viui.MainWindow( chat_log_directory, tray_icon, change_splash_text ) self.main_window.show() self.main_window.raise_()
def __init__(self, args): super(Application, self).__init__(args) # Set up paths chatLogDirectory = "" if len(sys.argv) > 1: chatLogDirectory = sys.argv[1] if not os.path.exists(chatLogDirectory): if sys.platform.startswith("darwin"): chatLogDirectory = os.path.join(os.path.expanduser("~"), "Library", "Application Support", "Eve Online", "p_drive", "User", "My Documents", "EVE", "logs", "Chatlogs") elif sys.platform.startswith("linux"): chatLogDirectory = os.path.join(os.path.expanduser("~"), "EVE", "logs", "Chatlogs") elif sys.platform.startswith("win32") or sys.platform.startswith("cygwin"): import ctypes.wintypes buf = ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH) ctypes.windll.shell32.SHGetFolderPathW(0, 5, 0, 0, buf) documentsPath = buf.value chatLogDirectory = os.path.join(documentsPath, "EVE", "logs", "Chatlogs") if not os.path.exists(chatLogDirectory): # None of the paths for logs exist, bailing out QMessageBox.critical(None, "No path to Logs", "No logs found at: " + chatLogDirectory, "Quit") sys.exit(1) # Setting local directory for cache and logging vintelDirectory = os.path.join(os.path.dirname(os.path.dirname(chatLogDirectory)), "vintel") if not os.path.exists(vintelDirectory): os.mkdir(vintelDirectory) cache.Cache.PATH_TO_CACHE = os.path.join(vintelDirectory, "cache-2.sqlite3") vintelLogDirectory = os.path.join(vintelDirectory, "logs") if not os.path.exists(vintelLogDirectory): os.mkdir(vintelLogDirectory) splash = QtGui.QSplashScreen(QtGui.QPixmap(resourcePath("vi/ui/res/logo.png"))) vintelCache = Cache() logLevel = vintelCache.getFromCache("logging_level") if not logLevel: logLevel = logging.WARN backGroundColor = vintelCache.getFromCache("background_color") if backGroundColor: self.setStyleSheet("QWidget { background-color: %s; }" % backGroundColor) splash.show() self.processEvents() # Setup logging for console and rotated log files formatter = logging.Formatter('%(asctime)s| %(message)s', datefmt='%m/%d %I:%M:%S') rootLogger = logging.getLogger() rootLogger.setLevel(level=logLevel) logFilename = vintelLogDirectory + "/output.log" fileHandler = RotatingFileHandler(maxBytes=(1048576*5), backupCount=7, filename=logFilename, mode='a') fileHandler.setFormatter(formatter) rootLogger.addHandler(fileHandler) consoleHandler = StreamHandler() consoleHandler.setFormatter(formatter) rootLogger.addHandler(consoleHandler) logging.critical("") logging.critical("------------------- Vintel %s starting up -------------------", version.VERSION) logging.critical("") logging.debug("Looking for chat logs at: %s", chatLogDirectory) logging.debug("Cache maintained here: %s", cache.Cache.PATH_TO_CACHE) logging.debug("Writing logs to: %s", vintelLogDirectory) trayIcon = systemtray.TrayIcon(self) trayIcon.show() self.mainWindow = viui.MainWindow(chatLogDirectory, trayIcon, backGroundColor) self.mainWindow.show() self.mainWindow.raise_() splash.finish(self.mainWindow)
def setupMap(self, initialize=False): self.mapTimer.stop() self.filewatcherThread.paused = True logging.info("Finding map file") regionName = self.cache.getFromCache("region_name") if not regionName: regionName = "Providence" svg = None try: with open(resourcePath("vi/ui/res/mapdata/{0}.svg".format(regionName))) as svgFile: svg = svgFile.read() except Exception as e: pass try: self.dotlan = dotlan.Map(regionName, svg) except dotlan.DotlanException as e: logging.error(e) QMessageBox.critical(None, "Error getting map", six.text_type(e), "Quit") sys.exit(1) if self.dotlan.outdatedCacheError: e = self.dotlan.outdatedCacheError diagText = "Something went wrong getting map data. Proceeding with older cached data. " \ "Check for a newer version and inform the maintainer.\n\nError: {0} {1}".format(type(e), six.text_type(e)) logging.warn(diagText) QMessageBox.warning(None, "Using map from cache", diagText, "Ok") # Load the jumpbridges logging.critical("Load jump bridges") self.setJumpbridges(self.cache.getFromCache("jumpbridge_url")) self.systems = self.dotlan.systems logging.critical("Creating chat parser") self.chatparser = ChatParser(self.pathToLogs, self.roomnames, self.systems) # Menus - only once if initialize: logging.critical("Initializing contextual menus") # Add a contextual menu to the mapView def mapContextMenuEvent(event): # if QApplication.activeWindow() or QApplication.focusWidget(): self.mapView.contextMenu.exec_(self.mapToGlobal(QPoint(event.x(), event.y()))) self.mapView.contextMenuEvent = mapContextMenuEvent self.mapView.contextMenu = self.trayIcon.contextMenu() # Clicking links self.mapView.connect(self.mapView, SIGNAL("linkClicked(const QUrl&)"), self.mapLinkClicked) # Also set up our app menus if not regionName: self.providenceCatchRegionAction.setChecked(True) elif regionName.startswith("Providencecatch"): self.providenceCatchRegionAction.setChecked(True) elif regionName.startswith("Catch"): self.catchRegionAction.setChecked(True) elif regionName.startswith("Providence"): self.providenceRegionAction.setChecked(True) elif regionName.startswith("Querious"): self.queriousRegionAction.setChecked(True) else: self.chooseRegionAction.setChecked(True) self.jumpbridgesButton.setChecked(False) self.statisticsButton.setChecked(False) # Update the new map view, then clear old statistics from the map and request new logging.critical("Updating the map") self.updateMapView() self.setInitialMapPositionForRegion(regionName) self.mapTimer.start(MAP_UPDATE_INTERVAL_MSECS) # Allow the file watcher to run now that all else is set up self.filewatcherThread.paused = False logging.critical("Map setup complete")
def __init__(self, pathToLogs, trayIcon): QtGui.QMainWindow.__init__(self) uic.loadUi(resourcePath('vi/ui/MainWindow.ui'), self) self.setWindowTitle("Vintel " + VERSION) self.taskbarIconQuiescent = QtGui.QIcon(resourcePath("vi/ui/res/logo_small.png")) self.taskbarIconWorking = QtGui.QIcon(resourcePath("vi/ui/res/logo_small_green.png")) self.setWindowIcon(self.taskbarIconQuiescent) self.pathToLogs = pathToLogs self.trayIcon = trayIcon self.cache = Cache() # Load my toon names self.knownPlayerNames = self.cache.getFromCache("known_player_names") if self.knownPlayerNames: self.knownPlayerNames = set(self.knownPlayerNames.split(",")) else: self.knownPlayerNames = set() # Set up my intel rooms roomnames = self.cache.getFromCache("room_names") if roomnames: roomnames = roomnames.split(",") else: roomnames = (u"TheCitadel", u"North Provi Intel", u"North Catch Intel") self.cache.putIntoCache("room_names", u",".join(roomnames), 60 * 60 * 24 * 365 * 5) self.roomnames = roomnames # Disable the sound UI if sound is not available if not SoundManager().soundAvailable: self.changeSound(disable=True) else: self.changeSound() # Initialize state self.initMapPosition = None self.oldClipboardContent = "" self.alarmDistance = 0 self.lastStatisticsUpdate = 0 self.alreadyShowedSoundWarning = False self.chatEntries = [] self.frameButton.setVisible(False) self.trayIcon.activated.connect(self.systemTrayActivated) self.clipboard = QtGui.QApplication.clipboard() self.clipboard.clear(mode=self.clipboard.Clipboard) # Fill in opacity values and connections self.opacityGroup = QtGui.QActionGroup(self.menu) for i in (100, 80, 60, 40, 20): action = QtGui.QAction("Opacity {0}%".format(i), None, checkable=True) if i == 100: action.setChecked(True) action.opacity = i / 100.0 self.connect(action, QtCore.SIGNAL("triggered()"), self.changeOpacity) self.opacityGroup.addAction(action) self.menuTransparency.addAction(action) # Wire up UI connections self.connect(self.clipboard, Qt.SIGNAL("changed(QClipboard::Mode)"), self.clipboardChanged) self.connect(self.zoomInButton, Qt.SIGNAL("clicked()"), self.zoomMapIn) self.connect(self.zoomOutButton, Qt.SIGNAL("clicked()"), self.zoomMapOut) self.connect(self.statisticsButton, Qt.SIGNAL("clicked()"), self.changeStatisticsVisibility) self.connect(self.jumpbridgesButton, Qt.SIGNAL("clicked()"), self.changeJumpbridgesVisibility) self.connect(self.chatLargeButton, Qt.SIGNAL("clicked()"), self.chatLarger) self.connect(self.chatSmallButton, Qt.SIGNAL("clicked()"), self.chatSmaller) self.connect(self.infoAction, Qt.SIGNAL("triggered()"), self.showInfo) self.connect(self.showChatAvatarsAction, Qt.SIGNAL("triggered()"), self.changeShowAvatars) self.connect(self.alwaysOnTopAction, Qt.SIGNAL("triggered()"), self.changeAlwaysOnTop) self.connect(self.chooseChatRoomsAction, Qt.SIGNAL("triggered()"), self.showChatroomChooser) self.connect(self.catchRegionAction, Qt.SIGNAL("triggered()"), lambda item=self.catchRegionAction: self.handleRegionMenuItemSelected(item)) self.connect(self.providenceRegionAction, Qt.SIGNAL("triggered()"), lambda item=self.providenceRegionAction: self.handleRegionMenuItemSelected(item)) self.connect(self.providenceCatchRegionAction, Qt.SIGNAL("triggered()"), lambda item=self.providenceCatchRegionAction: self.handleRegionMenuItemSelected(item)) self.connect(self.chooseRegionAction, Qt.SIGNAL("triggered()"), self.showRegionChooser) self.connect(self.showChatAction, Qt.SIGNAL("triggered()"), self.changeChatVisibility) self.connect(self.soundSetupAction, Qt.SIGNAL("triggered()"), self.showSoundSetup) self.connect(self.activateSoundAction, Qt.SIGNAL("triggered()"), self.changeSound) self.connect(self.useSpokenNotificationsAction, Qt.SIGNAL("triggered()"), self.changeUseSpokenNotifications) self.connect(self.floatingOverviewAction, Qt.SIGNAL("triggered()"), self.showFloatingOverview) self.connect(self.trayIcon, Qt.SIGNAL("alarm_distance"), self.changeAlarmDistance) self.connect(self.framelessWindowAction, Qt.SIGNAL("triggered()"), self.changeFrameless) self.connect(self.trayIcon, Qt.SIGNAL("change_frameless"), self.changeFrameless) self.connect(self.frameButton, Qt.SIGNAL("clicked()"), self.changeFrameless) self.connect(self.quitAction, Qt.SIGNAL("triggered()"), self.close) self.connect(self.trayIcon, Qt.SIGNAL("quit"), self.close) self.connect(self.jumpbridgeDataAction, Qt.SIGNAL("triggered()"), self.showJumbridgeChooser) # Create a timer to refresh the map, then load up the map, either from cache or dotlan self.mapTimer = QtCore.QTimer(self) self.connect(self.mapTimer, QtCore.SIGNAL("timeout()"), self.updateMapView) self.setupMap(True) # Recall cached user settings try: self.cache.recallAndApplySettings(self, "settings") except Exception as e: print str(e) self.trayIcon.showMessage("Settings error", "Something went wrong loading saved state:\n {0}".format(str(e)), 1) # Set up threads and their connections self.avatarFindThread = AvatarFindThread() self.connect(self.avatarFindThread, QtCore.SIGNAL("avatar_update"), self.updateAvatarOnChatEntry) self.avatarFindThread.start() self.kosRequestThread = KOSCheckerThread() self.connect(self.kosRequestThread, Qt.SIGNAL("kos_result"), self.showKosResult) self.kosRequestThread.start() self.filewatcherThread = filewatcher.FileWatcher(self.pathToLogs, 60 * 60 * 24) self.connect(self.filewatcherThread, QtCore.SIGNAL("file_change"), self.logFileChanged) self.filewatcherThread.start() self.versionCheckThread = amazon_s3.NotifyNewVersionThread() self.versionCheckThread.connect(self.versionCheckThread, Qt.SIGNAL("newer_version"), self.notifyNewerVersion) self.versionCheckThread.start() if sys.platform.startswith("win32") or sys.platform.startswith("cygwin"): font = self.statisticsButton.font() font.setPointSize(8) self.statisticsButton.setFont(font) self.jumpbridgesButton.setFont(font)
errorBox = QtGui.QMessageBox() errorBox.setText(str(notice) + str(msg) + str(versionInfo)) errorBox.exec_() else: print "Unhandled error caught by exceptHook: " + str(msg) sys.excepthook = exceptHook if __name__ == "__main__": gErrorFile = None gDebugging = True app = QtGui.QApplication(sys.argv) splash = QtGui.QSplashScreen(QtGui.QPixmap(resourcePath("vi/ui/res/logo.png"))) splash.show() app.processEvents() pathToLogs = "" if len(sys.argv) > 1: pathToLogs = sys.argv[1] if not os.path.exists(pathToLogs): if sys.platform.startswith("darwin"): pathToLogs = os.path.join(os.path.expanduser("~"), "Library", "Application Support", "Eve Online", "p_drive", "User", "My Documents", "EVE", "logs", "Chatlogs") elif sys.platform.startswith("linux"): pathToLogs = os.path.join(os.path.expanduser("~"), "EVE", "logs", "Chatlogs") elif sys.platform.startswith("win32") or sys.platform.startswith("cygwin"): import ctypes.wintypes