added all views
This commit is contained in:
parent
a332acad4f
commit
7c129f1825
2 changed files with 89 additions and 6 deletions
|
|
@ -39,9 +39,15 @@ class Tentia:
|
||||||
def init_web_views(self):
|
def init_web_views(self):
|
||||||
self.timeline = Windows.Timeline(self)
|
self.timeline = Windows.Timeline(self)
|
||||||
self.mentions = Windows.Timeline(self, "mentions", "Mentions")
|
self.mentions = Windows.Timeline(self, "mentions", "Mentions")
|
||||||
|
|
||||||
self.timeline.show()
|
self.timeline.show()
|
||||||
#self.mentions.show()
|
self.conversation = Windows.Timeline(self, "conversation", "Conversation")
|
||||||
|
self.profile = Windows.Timeline(self, "profile", "Profile")
|
||||||
|
|
||||||
|
def timeline_show(self):
|
||||||
|
self.timeline.show()
|
||||||
|
|
||||||
|
def mentions_show(self):
|
||||||
|
self.mentions.show()
|
||||||
|
|
||||||
|
|
||||||
class Controller(QtCore.QObject):
|
class Controller(QtCore.QObject):
|
||||||
|
|
@ -146,11 +152,20 @@ class Controller(QtCore.QObject):
|
||||||
isPrivate = "true"
|
isPrivate = "true"
|
||||||
|
|
||||||
func = "tentia_instance.sendNewMessage(\"{}\", \"{}\", \"{}\", {}, {}, {});".format(text, in_reply_to_status_id, in_reply_to_entity, locationObject, imageFilePath, isPrivate)
|
func = "tentia_instance.sendNewMessage(\"{}\", \"{}\", \"{}\", {}, {}, {});".format(text, in_reply_to_status_id, in_reply_to_entity, locationObject, imageFilePath, isPrivate)
|
||||||
self.app.timeline.webView.page().mainFrame().evaluateJavaScript(func)
|
self.app.timeline.evaluateJavaScript(func)
|
||||||
|
|
||||||
@QtCore.pyqtSlot(str, str)
|
@QtCore.pyqtSlot(str, str)
|
||||||
def showConversation(self, id, entity):
|
def showConversationForPostIdandEntity(self, postId, entity):
|
||||||
print "showConversation is not implemented yet"
|
func = "tentia_instance.showStatus('{}', '{}');".format(postId, entity)
|
||||||
|
self.app.conversation.evaluateJavaScript(func)
|
||||||
|
self.app.conversation.show()
|
||||||
|
|
||||||
|
@QtCore.pyqtSlot(str)
|
||||||
|
def showProfileForEntity(self, entity):
|
||||||
|
func = "tentia_instance.showProfileForEntity('{}');".format(entity)
|
||||||
|
self.app.profile.evaluateJavaScript(func)
|
||||||
|
self.app.profile.show()
|
||||||
|
|
||||||
|
|
||||||
@QtCore.pyqtSlot(str)
|
@QtCore.pyqtSlot(str)
|
||||||
def authentificationDidNotSucceed(self, errorMessage):
|
def authentificationDidNotSucceed(self, errorMessage):
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,16 @@ class Timeline:
|
||||||
self.window.resize(380, 600)
|
self.window.resize(380, 600)
|
||||||
self.window.setMinimumSize(200, 200)
|
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.webView = Helper.WebViewCreator(self.app, True, self.window)
|
self.webView = Helper.WebViewCreator(self.app, True, self.window)
|
||||||
self.webView.load_local(self.load_finished)
|
self.webView.load_local(self.load_finished)
|
||||||
self.window.setCentralWidget(self.webView)
|
self.window.setCentralWidget(self.webView)
|
||||||
|
|
@ -93,18 +103,53 @@ class Timeline:
|
||||||
# self.window.addWidget(self.webView)
|
# self.window.addWidget(self.webView)
|
||||||
self.initUI()
|
self.initUI()
|
||||||
|
|
||||||
|
def moveWindow(self, x=0, y=0):
|
||||||
|
self.show()
|
||||||
|
geo = self.window.geometry()
|
||||||
|
self.window.move(geo.x() + x, geo.y() + y)
|
||||||
|
self.hide()
|
||||||
|
|
||||||
|
|
||||||
def initUI(self):
|
def initUI(self):
|
||||||
newPostAction = QtGui.QAction("&New Post", self.window)
|
newPostAction = QtGui.QAction("&New Post", self.window)
|
||||||
newPostAction.setShortcut("Ctrl+N")
|
newPostAction.setShortcut("Ctrl+N")
|
||||||
newPostAction.setStatusTip("Open new post window")
|
newPostAction.setStatusTip("Open new post window")
|
||||||
newPostAction.triggered.connect(self.app.controller.openNewMessageWidow)
|
newPostAction.triggered.connect(QtGui.qApp.quit)
|
||||||
|
|
||||||
|
exitAction = QtGui.QAction("&Exit", self.window)
|
||||||
|
exitAction.setShortcut("Ctrl+Q")
|
||||||
|
exitAction.setStatusTip("Exit Tentia")
|
||||||
|
exitAction.triggered.connect(QtGui.qApp.quit)
|
||||||
|
|
||||||
menubar = self.window.menuBar()
|
menubar = self.window.menuBar()
|
||||||
fileMenu = menubar.addMenu("&File")
|
fileMenu = menubar.addMenu("&File")
|
||||||
fileMenu.addAction(newPostAction)
|
fileMenu.addAction(newPostAction)
|
||||||
|
fileMenu.addAction(exitAction)
|
||||||
|
|
||||||
|
timelineAction = QtGui.QAction("&Timeline", self.window)
|
||||||
|
timelineAction.setShortcut("Ctrl+1")
|
||||||
|
timelineAction.setStatusTip("Show Timeline")
|
||||||
|
timelineAction.triggered.connect(self.app.timeline_show)
|
||||||
|
|
||||||
|
mentionsAction = QtGui.QAction("&Mentions", self.window)
|
||||||
|
mentionsAction.setShortcut("Ctrl+2")
|
||||||
|
mentionsAction.setStatusTip("Show Mentions")
|
||||||
|
mentionsAction.triggered.connect(self.app.mentions_show)
|
||||||
|
|
||||||
|
hideAction = QtGui.QAction("&Hide window", self.window)
|
||||||
|
hideAction.setShortcut("Ctrl+W")
|
||||||
|
hideAction.setStatusTip("Hide this window")
|
||||||
|
hideAction.triggered.connect(self.hide)
|
||||||
|
|
||||||
|
windowMenu = menubar.addMenu("&Windows")
|
||||||
|
windowMenu.addAction(timelineAction)
|
||||||
|
windowMenu.addAction(mentionsAction)
|
||||||
|
windowMenu.addAction(hideAction)
|
||||||
|
|
||||||
def show(self):
|
def show(self):
|
||||||
self.window.show()
|
self.window.show()
|
||||||
|
self.window.raise_()
|
||||||
|
QtGui.qApp.setActiveWindow(self.window)
|
||||||
|
|
||||||
def hide(self):
|
def hide(self):
|
||||||
self.window.hide()
|
self.window.hide()
|
||||||
|
|
@ -116,6 +161,9 @@ class Timeline:
|
||||||
def set_window_title(self, title):
|
def set_window_title(self, title):
|
||||||
self.window.setWindowTitle(title)
|
self.window.setWindowTitle(title)
|
||||||
|
|
||||||
|
def evaluateJavaScript(self, func):
|
||||||
|
return self.webView.page().mainFrame().evaluateJavaScript(func)
|
||||||
|
|
||||||
|
|
||||||
class Oauth:
|
class Oauth:
|
||||||
|
|
||||||
|
|
@ -226,6 +274,26 @@ class NewPost(QtGui.QMainWindow):
|
||||||
fileMenu.addAction(newPostAction)
|
fileMenu.addAction(newPostAction)
|
||||||
fileMenu.addAction(sendPostAction)
|
fileMenu.addAction(sendPostAction)
|
||||||
|
|
||||||
|
timelineAction = QtGui.QAction("&Timeline", self.window)
|
||||||
|
timelineAction.setShortcut("Ctrl+1")
|
||||||
|
timelineAction.setStatusTip("Show Timeline")
|
||||||
|
timelineAction.triggered.connect(self.app.timeline_show)
|
||||||
|
|
||||||
|
mentionsAction = QtGui.QAction("&Mentions", self.window)
|
||||||
|
mentionsAction.setShortcut("Ctrl+2")
|
||||||
|
mentionsAction.setStatusTip("Show Mentions")
|
||||||
|
mentionsAction.triggered.connect(self.app.mentions_show)
|
||||||
|
|
||||||
|
hideAction = QtGui.QAction("&Hide window", self.window)
|
||||||
|
hideAction.setShortcut("Ctrl+W")
|
||||||
|
hideAction.setStatusTip("Hide this window")
|
||||||
|
hideAction.triggered.connect(self.close)
|
||||||
|
|
||||||
|
windowMenu = menubar.addMenu("&Windows")
|
||||||
|
windowMenu.addAction(timelineAction)
|
||||||
|
windowMenu.addAction(mentionsAction)
|
||||||
|
windowMenu.addAction(hideAction)
|
||||||
|
|
||||||
def setIsPrivate(self, is_private):
|
def setIsPrivate(self, is_private):
|
||||||
self.isPrivate = is_private
|
self.isPrivate = is_private
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue