Skip to content

Commit

Permalink
Fixed bugs, added update check function
Browse files Browse the repository at this point in the history
  • Loading branch information
jkakavas committed Feb 2, 2014
1 parent 854cf55 commit 38f5516
Show file tree
Hide file tree
Showing 35 changed files with 25,766 additions and 9,502 deletions.
43 changes: 41 additions & 2 deletions creepy/CreepyMain.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
import shelve
import functools
import csv
import urllib2
from distutils.version import StrictVersion
from configobj import ConfigObj
from PyQt4.QtCore import QString, QThread, SIGNAL, QUrl, QDateTime, QDate, QRect, Qt
from PyQt4.QtGui import QMainWindow, QApplication, QMessageBox, QFileDialog, QWidget, QScrollArea, QVBoxLayout
from PyQt4.QtGui import QHBoxLayout, QLabel, QLineEdit, QCheckBox, QPushButton, QStackedWidget,QGridLayout, QMenu
from PyQt4.QtGui import QMainWindow, QApplication, QMessageBox, QFileDialog, QWidget, QScrollArea, QVBoxLayout, QIcon, QPixmap
from PyQt4.QtGui import QHBoxLayout, QLabel, QLineEdit, QCheckBox, QPushButton, QStackedWidget,QGridLayout, QMenu, QTableWidgetItem
from PyQt4.QtWebKit import QWebPage
from ui.CreepyUI import Ui_CreepyMainWindow
from yapsy.PluginManager import PluginManagerSingleton
Expand All @@ -27,6 +30,7 @@
from components.FilterLocationsPointDialog import FilterLocationsPointDialog
from components.AboutDialog import AboutDialog
from components.VerifyDeleteDialog import VerifyDeleteDialog
from components.UpdateCheckDialog import UpdateCheckDialog
from utilities import GeneralUtilities
# set up logging
logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -86,6 +90,7 @@ def run(self):
self.emit(SIGNAL('locations(PyQt_PyObject)'), self.project)

def __init__(self, parent=None):
self.version = "1.1"
QWidget.__init__(self, parent)
self.ui = Ui_CreepyMainWindow()
self.ui.setupUi(self)
Expand Down Expand Up @@ -118,8 +123,42 @@ def __init__(self, parent=None):
self.ui.actionShowHeatMap.toggled.connect(self.toggleHeatMap)
self.ui.actionReportProblem.triggered.connect(GeneralUtilities.reportProblem)
self.ui.actionAbout.triggered.connect(self.showAboutDialog)
self.ui.actionCheckUpdates.triggered.connect(self.checkForUpdatedVersion)
self.ui.actionExit.triggered.connect(self.close)
self.loadProjectsFromStorage()
#If option enabled check for updated version

def checkForUpdatedVersion(self):
'''
Checks www.geocreepy.com for an updated version and returns a tuple with the
result and the latest version number
'''

try:
latestVersion = urllib2.urlopen("http://www.geocreepy.com/version.html").read().rstrip()

updateCheckDialog = UpdateCheckDialog()
updateCheckDialog.ui.versionsTableWidget.setHorizontalHeaderLabels(('','Component','Status','Installed','Available'))
updateCheckDialog.ui.versionsTableWidget.setItem(0,1,QTableWidgetItem('Creepy'))
if StrictVersion(latestVersion) > StrictVersion(self.version):
updateCheckDialog.ui.versionsTableWidget.setItem(0,0,QTableWidgetItem(QIcon(QPixmap(':/creepy/exclamation')), ''))
updateCheckDialog.ui.versionsTableWidget.setItem(0,2,QTableWidgetItem('Outdated'))
updateCheckDialog.ui.dlNewVersionLabel.setText('<html><head/><body><p>Download the latest version from <a href="http://www.geocreepy.com"><span style=" text-decoration: underline; color:#0000ff;">geocreepy.com</span></a></p></body></html>')
else:
updateCheckDialog.ui.versionsTableWidget.setItem(0,0,QTableWidgetItem(QIcon(QPixmap(':/creepy/tick')), ''))
updateCheckDialog.ui.versionsTableWidget.setItem(0,2,QTableWidgetItem('Up To Date'))
updateCheckDialog.ui.dlNewVersionLabel.setText('<html><head/><body><p>You are already using the latest version of creepy. </p></body></html>')
updateCheckDialog.ui.versionsTableWidget.setItem(0,3,QTableWidgetItem(self.version))
updateCheckDialog.ui.versionsTableWidget.setItem(0,4,QTableWidgetItem(latestVersion))
updateCheckDialog.show()
updateCheckDialog.exec_()
except Exception,err:
if type(err) == 'string':
mes = err
else:
mess = err.message
self.showWarning(self.trUtf8('Error checking for updates'), mess)

def showFilterLocationsPointDialog(self):
filterLocationsPointDialog = FilterLocationsPointDialog()
Expand Down
2 changes: 1 addition & 1 deletion creepy/components/PersonProjectWizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from models.ProjectWizardPossibleTargetsTable import ProjectWizardPossibleTargetsTable
from models.InputPlugin import InputPlugin
from yapsy.PluginManager import PluginManagerSingleton
from ui.CreepyPersonProjectWizard import Ui_personProjectWizard
from ui.PersonProjectWizard import Ui_personProjectWizard

try:
_fromUtf8 = QString.fromUtf8
Expand Down
2 changes: 1 addition & 1 deletion creepy/components/PluginConfigurationCheckDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
from PyQt4.QtGui import QDialog
from PyQt4.QtCore import Qt
from ui.CreepyPluginConfigurationCheckdialog import Ui_checkPluginConfigurationDialog
from ui.PluginConfigCheckdialog import Ui_checkPluginConfigurationDialog
class PluginConfigurationCheckdialog(QDialog):
"""
Loads the Plugin Configuration Check Dialog that provides information indicating
Expand Down
2 changes: 1 addition & 1 deletion creepy/components/PluginsConfigurationDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from PyQt4.QtGui import QDialog, QLabel, QLineEdit, QScrollArea, QCheckBox
from yapsy.PluginManager import PluginManagerSingleton
from models.InputPlugin import InputPlugin
from ui.CreepyPluginsConfigurationDialog import Ui_PluginsConfigurationDialog
from ui.PluginsConfig import Ui_PluginsConfigurationDialog
from components.PluginConfigurationCheckDialog import PluginConfigurationCheckdialog
class PluginsConfigurationDialog(QDialog):
def __init__(self, parent=None):
Expand Down
9 changes: 9 additions & 0 deletions creepy/components/UpdateCheckDialog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
from PyQt4.QtGui import QDialog
from ui.UpdateCheckDialog import Ui_UpdateCheckDialog
class UpdateCheckDialog(QDialog):
def __init__(self, parent=None):
QDialog.__init__(self, parent)
self.ui = Ui_UpdateCheckDialog()
self.ui.setupUi(self)
Binary file added creepy/include/Eye_of_Sauron_by_Blood_Solice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 23 additions & 41 deletions creepy/include/creepy_resources.qrc
Original file line number Diff line number Diff line change
@@ -1,44 +1,26 @@
<RCC>
<qresource prefix="cr">
<file>143 Attention.png</file>
<file>200 CircledMinus.png</file>
<file>219 CircledSync.png</file>
<file>226 CircledGeo.png</file>
<file>020 DocumentCSV.png</file>
<file>020 DocumentKML.png</file>
<file>021 Document Text.png</file>
<file>022 Document Add.png</file>
<file>054 Preferences2.png</file>
<file>003 User2.png</file>
<file>005 CalendarDate.png</file>
<file>011 InboxDownload.png</file>
<file>013 MagnifyingGlass.png</file>
<file>059 CircledOff.png</file>
<file>060 Off.png</file>
<file>061 Sync.png</file>
<file>070 Minus.png</file>
<file>077 Location.png</file>
<file>078 Pin.png</file>
<file>079 Pin2.png</file>
<file>084 Photo.png</file>
<file>107 Flag.png</file>
<file>119 Eye.png</file>
<file>144 Forbidden.png</file>
<file>165 ExclamationMark.png</file>
<file>196 Time.png</file>
<file>197 Compass.png</file>
<file>project_actionmenu_delete.png</file>
<file>heatmap.png</file>
<file>project_actionmenu_edit.png</file>
<file>analysis.png</file>
<file>folder_locations.png</file>
<file>project_icon.png</file>
<file>analyze.png</file>
<file>add.png</file>
<file>cvs.png</file>
<file>geolocate.png</file>
<file>creepy32.png</file>
<file>plugins_config.png</file>
<file>save.png</file>
<qresource prefix="creepy">
<file alias="creepy">Eye_of_Sauron_by_Blood_Solice.png</file>
<file alias="calendar">../../../../icons/32/calendar-day.png</file>
<file alias="cross">../../../../icons/32/cross.png</file>
<file alias="cross-circle">../../../../icons/32/cross-circle.png</file>
<file alias="exclamation">../../../../icons/32/exclamation.png</file>
<file alias="properties">../../../../icons/32/application-sidebar-list.png</file>
<file alias="image-instagram">../../../../icons/32/image-instagram.png</file>
<file alias="heatmap">../../../../icons/24/fire.png</file>
<file alias="info">../../../../icons/32/information.png</file>
<file alias="lock">../../../../icons/32/lock.png</file>
<file alias="minus">../../../../icons/32/minus.png</file>
<file alias="map">../../../../icons/32/map.png</file>
<file alias="minus-circle">../../../../icons/32/minus-circle.png</file>
<file alias="export">../../../../icons/24/blue-document-export.png</file>
<file alias="globe">../../../../icons/24/globe.png</file>
<file alias="marker">../../../../icons/24/marker.png</file>
<file alias="target">../../../../icons/24/target.png</file>
<file alias="user">../../../../icons/24/user.png</file>
<file alias="add">../../../../icons/32/plus-circle.png</file>
<file alias="folder">../../../../icons/32/blue-folder-horizontal.png</file>
<file alias="bookmark">../../../../icons/32/bookmark.png</file>
<file alias="tick">../../../../icons/32/tick.png</file>
</qresource>
</RCC>
1 change: 0 additions & 1 deletion creepy/models/InputPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def getConfigObj(self):
config_file = os.path.join(os.getcwdu(),'plugins', self.name, config_filename)
config = ConfigObj(infile=config_file)
config.create_empty=False
return config

def readConfiguration(self, category):
config_filename = self.name+'.conf'
Expand Down
2 changes: 1 addition & 1 deletion creepy/models/PluginConfigurationListModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def data(self,index,role):
pixmap = QPixmap(picturePath)
return QIcon(pixmap)
else:
pixmap = QPixmap(os.path.join(os.getcwdu(), 'include', 'generic_plugin.png'))
pixmap = QPixmap(':/creepy/folder')
return QIcon(pixmap)
else:
return QVariant()
12 changes: 3 additions & 9 deletions creepy/models/ProjectTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ def data(self, index, role):
return QVariant(node.name())
if role == Qt.DecorationRole:
if node.nodeType() == 'PROJECT':
return QIcon(QPixmap(':/cr/project_icon.png'))
return QIcon(QPixmap(':/creepy/folder'))
if node.nodeType() == "LOCATIONS":
return QIcon(QPixmap(':/cr/folder_locations.png'))
return QIcon(QPixmap(':/creepy/marker'))
if node.nodeType() == 'ANALYSIS':
return QIcon(QPixmap(':/cr/analysis.png'))
if node.nodeType() == 'LOCATION':
return QIcon(QPixmap(':/cr/index.png'))
else:
return QVariant()

Expand Down Expand Up @@ -173,8 +171,4 @@ def __init__(self, name, parent=None):
self._type = 'ANALYSIS'
self.analysis = ""

class LocationNode(ProjectTreeNode):
def __init__(self, name, location, parent=None):
super(LocationNode, self).__init__(name, parent)
self._type = 'Location'
self.location = location

2 changes: 1 addition & 1 deletion creepy/models/ProjectWizardPossibleTargetsTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def data(self, index, role):
pixmap = QPixmap(picturePath)
return QIcon(pixmap.scaled(30, 30, Qt.IgnoreAspectRatio, Qt.FastTransformation))
else:
pixmap = QPixmap(os.path.join(os.getcwdu(), 'include', 'generic_user.png'))
pixmap = QPixmap(':/creepy/user')
pixmap.scaled(20, 20, Qt.IgnoreAspectRatio)
return QIcon(pixmap)
if role == Qt.DisplayRole:
Expand Down
2 changes: 1 addition & 1 deletion creepy/plugins/instagram/instagram.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[string_options]
hidden_client_secret = aad972efd8454fa5b6ff57405ea3f285
redirect_uri = https://creepy.ilektrojohn.com
hidden_access_token =
hidden_access_token = ""
hidden_client_id = 05f8e4eb06664006a839f0dd49a50969
infowindow_html = <div><div><h3>Retrieved from @PLUGIN@ </h3></div><div><p>Caption was : @TEXT@ <p><p>Link to the original image : @LINK@ <p><p>It was taken on : @DATE@ <p></div></div>

Expand Down
2 changes: 1 addition & 1 deletion creepy/plugins/twitter/twitter.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ hidden_application_key = B6DTlnTBKROLI6bQlGurSw
hidden_application_secret = sX1TWFHT7xsUXpNVPZZgqasaC4OFjdFpI4s5KH8GI

[boolean_options]
exclude_geo_disabled = True
exclude_geo_disabled = False



Expand Down
2 changes: 1 addition & 1 deletion creepy/plugins/twitter/twitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def getAuthenticatedAPI(self):

def runConfigWizard(self):
try:
oAuthHandler = tweepy.OAuthHandler(self.options_string['hidden_application_key'], self.options_string['hidden_application_secret'])
oAuthHandler = tweepy.OAuthHandler(self.options_string['hidden_application_key'], self.options_string['hidden_application_secret'], secure=True)
authorizationURL = oAuthHandler.get_authorization_url(True)
self.wizard = QWizard()
page1 = QWizardPage()
Expand Down
7 changes: 4 additions & 3 deletions creepy/ui/AboutDialog.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file '..\gui\aboutDialog.ui'
# Form implementation generated from reading ui file '.\aboutDialog.ui'
#
# Created: Sun Dec 22 18:31:12 2013
# Created: Fri Jan 31 15:29:04 2014
# by: PyQt4 UI code generator 4.9.4
#
# WARNING! All changes made in this file will be lost!
Expand All @@ -18,8 +18,9 @@ class Ui_aboutDialog(object):
def setupUi(self, aboutDialog):
aboutDialog.setObjectName(_fromUtf8("aboutDialog"))
aboutDialog.resize(394, 338)
aboutDialog.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/cr/creepy32.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/creepy/creepy")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
aboutDialog.setWindowIcon(icon)
aboutDialog.setModal(False)
self.buttonBox = QtGui.QDialogButtonBox(aboutDialog)
Expand Down
77 changes: 77 additions & 0 deletions creepy/ui/CheckUpdateDialog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file '.\updateCheckDialog.ui'
#
# Created: Wed Jan 08 19:47:23 2014
# by: PyQt4 UI code generator 4.9.4
#
# WARNING! All changes made in this file will be lost!

from PyQt4 import QtCore, QtGui

try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s

class Ui_UpdateAvailableDialog(object):
def setupUi(self, UpdateAvailableDialog):
UpdateAvailableDialog.setObjectName(_fromUtf8("UpdateAvailableDialog"))
UpdateAvailableDialog.resize(594, 300)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/cr/Eye_of_Sauron_by_Blood_Solice.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
UpdateAvailableDialog.setWindowIcon(icon)
self.buttonBox = QtGui.QDialogButtonBox(UpdateAvailableDialog)
self.buttonBox.setGeometry(QtCore.QRect(240, 240, 341, 32))
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Close)
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
self.verticalLayoutWidget = QtGui.QWidget(UpdateAvailableDialog)
self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 571, 221))
self.verticalLayoutWidget.setObjectName(_fromUtf8("verticalLayoutWidget"))
self.verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget)
self.verticalLayout.setMargin(0)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.label = QtGui.QLabel(self.verticalLayoutWidget)
self.label.setObjectName(_fromUtf8("label"))
self.verticalLayout.addWidget(self.label)
self.versionsTableWidget = QtGui.QTableWidget(self.verticalLayoutWidget)
self.versionsTableWidget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
self.versionsTableWidget.setTabKeyNavigation(False)
self.versionsTableWidget.setProperty("showDropIndicator", False)
self.versionsTableWidget.setRowCount(1)
self.versionsTableWidget.setColumnCount(4)
self.versionsTableWidget.setObjectName(_fromUtf8("versionsTableWidget"))
item = QtGui.QTableWidgetItem()
self.versionsTableWidget.setItem(0, 0, item)
item = QtGui.QTableWidgetItem()
self.versionsTableWidget.setItem(0, 1, item)
item = QtGui.QTableWidgetItem()
self.versionsTableWidget.setItem(0, 2, item)
self.versionsTableWidget.horizontalHeader().setStretchLastSection(True)
self.versionsTableWidget.verticalHeader().setVisible(False)
self.verticalLayout.addWidget(self.versionsTableWidget)

self.retranslateUi(UpdateAvailableDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), UpdateAvailableDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), UpdateAvailableDialog.reject)
QtCore.QMetaObject.connectSlotsByName(UpdateAvailableDialog)

def retranslateUi(self, UpdateAvailableDialog):
UpdateAvailableDialog.setWindowTitle(QtGui.QApplication.translate("UpdateAvailableDialog", "Update Check", None, QtGui.QApplication.UnicodeUTF8))
self.label.setText(QtGui.QApplication.translate("UpdateAvailableDialog", "<html><head/><body><p><span style=\" font-weight:600;\">Results of Update Check</span></p></body></html>", None, QtGui.QApplication.UnicodeUTF8))
__sortingEnabled = self.versionsTableWidget.isSortingEnabled()
self.versionsTableWidget.setSortingEnabled(False)
self.versionsTableWidget.setSortingEnabled(__sortingEnabled)

import creepy_resources_rc

if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
UpdateAvailableDialog = QtGui.QDialog()
ui = Ui_UpdateAvailableDialog()
ui.setupUi(UpdateAvailableDialog)
UpdateAvailableDialog.show()
sys.exit(app.exec_())

Loading

0 comments on commit 38f5516

Please sign in to comment.