Merge branch 'master' of github.com:jeena/Tentia

This commit is contained in:
Jeena Paradies 2012-12-30 23:21:37 +01:00
commit a2ee10ffd9
6 changed files with 47 additions and 24 deletions

1
.gitignore vendored
View file

@ -5,3 +5,4 @@ dsa_priv.pem
Mac/.DS_Store
build
.DS_Store
*~

View file

@ -5,6 +5,8 @@ from PyQt4.QtGui import *
from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply
from PyQt4.QtWebKit import QWebView
import array
class WebPage(QtWebKit.QWebPage):
def __init__(self, parent=0, app=None):
super(QtWebKit.QWebPage, self).__init__(parent)
@ -84,3 +86,30 @@ class PostModel:
self.imageFilePath = None
self.isPrivate = False
class RestorableWindow(QtGui.QMainWindow):
def __init__(self, action, app):
self.action = action
self.app = app
QtGui.QMainWindow.__init__(self)
self.restoreGeometry(QtCore.QByteArray.fromRawData(self.app.controller.stringForKey("mainWindowGeometry-" + self.action)))
self.restoreState(QtCore.QByteArray.fromRawData(self.app.controller.stringForKey("mainWindowState-" + self.action)))
def closeEvent(self, event):
self._saveGeometry()
def _saveGeometry(self):
self.app.controller.setStringForKey(self.saveGeometry(), "mainWindowGeometry-" + self.action)
self.app.controller.setStringForKey(self.saveState(), "mainWindowState-" + self.action)
def hide(self):
self._saveGeometry()
QtGui.QMainWindow.hide(self)
def sizeHint(self):
return QtCore.QSize(300, 500)
def show(self):
QtGui.QMainWindow.show(self)
self.activateWindow()
self.raise_()

View file

@ -14,7 +14,7 @@ class Tentia:
self.preferences = Windows.Preferences(self)
self.preferences.show()
self.oauth_implementation = Windows.Oauth(self)
self.oauth_implementation = Windows.Oauth(self)
if self.controller.stringForKey("user_access_token") != "":
self.authentification_succeded()
@ -111,8 +111,14 @@ class Controller(QtCore.QObject):
self.app.mentions.evaluateJavaScript("tentia_instance.unread_mentions = 0;")
@QtCore.pyqtSlot(str, str, str, str)
def notificateUserAboutMention(self, text, name, post_id, entity):
print "notificateUserAboutMention is not implemented yet"
def notificateUserAboutMentionFromNameWithPostIdAndEntity(self, text, name, post_id, entity):
try:
subprocess.check_output(['kdialog', '--passivepopup', name + ' mentioned you: ' + text])
except OSError:
try:
subprocess.check_output(['notify-send', '-i', 'dialog-information', name + ' mentioned you on Tent', text])
except OSError:
pass
@QtCore.pyqtSlot(str)
def openNewMessageWidow(self, string):

View file

@ -81,32 +81,16 @@ class Timeline:
self.action = action
self.title = title
self.window = QtGui.QMainWindow()
self.window = Helper.RestorableWindow(action, self.app)
self.window.setWindowTitle(title)
self.window.resize(380, 600)
self.window.setMinimumSize(200, 200)
#
#x, y = 0, 0
#if action == "mentions":
# x, y = 20, 20
#elif action == "conversation":
# x, y = 40, 20
#elif action == "profile":
# x, y = 40, 40
#self.moveWindow(x, y)
self.window.setWindowIcon(QtGui.QIcon(self.app.resources_path() + "/images/Icon.png"))
self.webView = Helper.WebViewCreator(self.app, True, self.window)
self.webView.load_local(self.load_finished)
self.window.setCentralWidget(self.webView)
# self.window.addWidget(self.webView)
self.initUI()
self.window.setWindowIcon(QtGui.QIcon(self.app.resources_path() + "/images/Icon.png"))
def moveWindow(self, x=0, y=0):
self.show()
geo = self.window.geometry()
@ -247,10 +231,10 @@ class Login(QtGui.QDialog):
#self.buttonLogin.clicked.connect(callback)
#self.label.setText("The server " + url.host() + " requires a username and password.")
class NewPost(QtGui.QMainWindow):
class NewPost(Helper.RestorableWindow):
def __init__(self, app):
self.app = app
QtGui.QPlainTextEdit.__init__(self)
Helper.RestorableWindow.__init__(self, "newpost", self.app)
self.setWindowIcon(QtGui.QIcon(self.app.resources_path() + "/images/Icon.png"))

View file

@ -19,3 +19,4 @@ Thanks everyone in the Open Source community! Tentia is using:
- Qt - http://qt.digia.com/
- python - http://www.python.org/
- PyQt - http://wiki.python.org/moin/PyQt
- test

View file

@ -107,7 +107,9 @@ define(function() {
HostApp.notificateUserAboutMention = function(text, name, post_id, entity) {
if (OS_TYPE == "mac") {
controller.notificateUserAboutMention_fromName_withPostId_andEntity_(text, name, post_id, entity);
}
} else {
controller.notificateUserAboutMentionFromNameWithPostIdAndEntity(text, name, post_id, entity);
}
}
HostApp.alertTitleWithMessage = function(title, message) {