diff --git a/Linux/Bungloo.py b/Linux/Bungloo.py index 6eaebd5..2f849ab 100755 --- a/Linux/Bungloo.py +++ b/Linux/Bungloo.py @@ -21,7 +21,7 @@ class Bungloo: 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() @@ -43,17 +43,17 @@ class Bungloo: def authentification_succeded(self): self.preferences.hide() - if hasattr(self, "oauth_implementation"): - self.oauth_implementation.hide() + #if hasattr(self, "oauth_implementation"): + # self.oauth_implementation.hide() self.preferences.active(False) self.init_web_views() def init_web_views(self): self.timeline = Windows.Timeline(self) - self.mentions = Windows.Timeline(self, "mentions", "Mentions") + #self.mentions = Windows.Timeline(self, "mentions", "Mentions") self.timeline.show() - self.conversation = Windows.Timeline(self, "conversation", "Conversation") - self.profile = Windows.Timeline(self, "profile", "Profile") + #self.conversation = Windows.Timeline(self, "conversation", "Conversation") + #self.profile = Windows.Timeline(self, "profile", "Profile") self.find_entity = Windows.FindEntity(self) def timeline_show(self): @@ -61,7 +61,7 @@ class Bungloo: def mentions_show(self): self.controller.unreadMentions(0) - self.mentions.show() + #self.mentions.show() def find_entity_show(self): self.find_entity.show() @@ -131,7 +131,7 @@ class Controller(QtCore.QObject): self.app.timeline.set_window_title("Bungloo (^" + str(i) + ")") else: self.app.timeline.set_window_title("Bungloo") - self.app.mentions.evaluateJavaScript("bungloo_instance.unread_mentions = 0;") + #self.app.mentions.evaluateJavaScript("bungloo_instance.unread_mentions = 0;") @QtCore.pyqtSlot(str, str, str, str) def notificateUserAboutMentionFromNameWithPostIdAndEntity(self, text, name, post_id, entity): @@ -188,28 +188,29 @@ class Controller(QtCore.QObject): if message.isPrivate: isPrivate = "true" - func = u"bungloo_instance.sendNewMessage(\"{}\", \"{}\", \"{}\", {}, {}, {});".format(text, in_reply_to_status_id, in_reply_to_entity, locationObject, imageFilePath, isPrivate) + func = u"bungloo.timeline.sendNewMessage(\"{}\", \"{}\", \"{}\", {}, {}, {});".format(text, in_reply_to_status_id, in_reply_to_entity, locationObject, imageFilePath, isPrivate) self.app.timeline.evaluateJavaScript(func) @QtCore.pyqtSlot(str, str) def showConversationForPostIdandEntity(self, postId, entity): - func = "bungloo_instance.showStatus('{}', '{}');".format(postId, entity) - self.app.conversation.evaluateJavaScript(func) - self.app.conversation.show() + func = "bungloo.sidebar.onConversation(); bungloo.conversation.showStatus('{}', '{}');".format(postId, entity) + self.app.timeline.evaluateJavaScript(func) + self.app.timeline.show() @QtCore.pyqtSlot(str) def showProfileForEntity(self, entity): - func = "bungloo_instance.showProfileForEntity('{}');".format(entity) - self.app.profile.evaluateJavaScript(func) - self.app.profile.show() + func = "bungloo.sidebar.onEntityProfile(); bungloo.entityProfile.showProfileForEntity('{}');".format(entity) + self.app.timeline.evaluateJavaScript(func) @QtCore.pyqtSlot(str, str) def notificateViewsAboutDeletedPostWithIdbyEntity(self, post_id, entity): - func = "bungloo_instance.postDeleted('{}', '{}')".format(post_id, entity); + f = ".postDeleted('{}', '{}')".format(post_id, entity); + func = "bungloo.timeline" + f + ";" + func += "bungloo.mentions" + f + ";" + func += "bungloo.conversation" + f + ";" + func += "bungloo.entityProfile" + f + ";" + self.app.timeline.evaluateJavaScript(func) - self.app.mentions.evaluateJavaScript(func) - self.app.conversation.evaluateJavaScript(func) - self.app.profile.evaluateJavaScript(func) @QtCore.pyqtSlot(str) def authentificationDidNotSucceed(self, errorMessage): diff --git a/Linux/Helper.py b/Linux/Helper.py index 21b2212..baa31b8 100644 --- a/Linux/Helper.py +++ b/Linux/Helper.py @@ -39,6 +39,30 @@ class WebViewCreator(QtWebKit.QWebView): self.connect(self, SIGNAL("linkClicked (const QUrl&)"), self.app.controller.openQURL) self.setPage(WebPage(self, self.app)) + self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) + self.customContextMenuRequested.connect(self.context_menu_requested) + self.actions = [] + QtWebKit.QWebSettings.globalSettings().setAttribute(QtWebKit.QWebSettings.DeveloperExtrasEnabled, True) + + def context_menu_requested(self, point): + context_menu = QtGui.QMenu() + + for action in self.actions: + if action.isEnabled(): + context_menu.addAction(action) + + frame = self.page().currentFrame() + + hit_test = frame.hitTestContent(point) + if unicode(hit_test.linkUrl().toString()): + context_menu.addAction(self.action_copy_link) + + if self.settings().testAttribute(QtWebKit.QWebSettings.DeveloperExtrasEnabled): + context_menu.addSeparator() + context_menu.addAction(self.pageAction(QtWebKit.QWebPage.InspectElement)) + + context_menu.exec_(self.mapToGlobal(point)) + def load_local(self, callback=None): self.page().settings().setAttribute(QtWebKit.QWebSettings.LocalContentCanAccessRemoteUrls, True) self.page().settings().setAttribute(QtWebKit.QWebSettings.LocalStorageEnabled, True) diff --git a/Linux/Windows.py b/Linux/Windows.py index ee1fc0c..9b2769f 100644 --- a/Linux/Windows.py +++ b/Linux/Windows.py @@ -91,6 +91,8 @@ class Timeline: self.initUI() + self.webView.triggerPageAction(QtWebKit.QWebPage.InspectElement) + def moveWindow(self, x=0, y=0): self.show() geo = self.window.geometry() diff --git a/WebKit/css/default.css b/WebKit/css/default.css index dfe42cf..17527bd 100644 --- a/WebKit/css/default.css +++ b/WebKit/css/default.css @@ -16,6 +16,36 @@ a { outline: 0; } +#sidebar { + position: fixed; + top: 0; + left: 0; + width: 62px; + height: 100%; + background: #333; +} + +#sidebar ul { + list-style-type: none; + margin: 0; + padding: 7px 0 0 0; + text-align: center; +} + +#siedebar a { + color: #5b5b5b; +} + +#sidebar .sidebar-user img { + max-width: 50px; + max-height: 50px; + border-radius: 8px; +} + +#content { + margin-left: 62px; +} + ol { list-style-type: none; margin: 0; @@ -39,37 +69,37 @@ ol li, .error, header.profile { color: red; } -body > ol > li { +#content ol > li { } -body > ol > li:first-child { +#content ol > li:first-child { border-top: 0; } -body > ol > li:nth-child(odd), .error, header.profile { +#content ol > li:nth-child(odd), .error, header.profile { background: #fafafa; } -body > ol > li:nth-child(even) { +#content ol > li:nth-child(even) { background: #f2f2f2; } -body > ol > li:hover { +#content ol > li:hover { background: #dedede; } -body > ol > li.highlighteffect { +#content ol > li.highlighteffect { background-color: #FFFBD0; -webkit-transition: background-color 200ms linear; } -body > ol > li.highlighteffect-after { +#content ol > li.highlighteffect-after { -webkit-transition: background-color 1000ms linear; } -body > ol > li:after, header.profile:after { +#content ol > li:after, header.profile:after { content: "."; display: block; clear: both; diff --git a/WebKit/img/background.png b/WebKit/img/background.png index dcce74e..f3bd7ae 100644 Binary files a/WebKit/img/background.png and b/WebKit/img/background.png differ diff --git a/WebKit/img/sidebar/conversation.png b/WebKit/img/sidebar/conversation.png new file mode 100644 index 0000000..1670531 Binary files /dev/null and b/WebKit/img/sidebar/conversation.png differ diff --git a/WebKit/img/sidebar/conversation_active.png b/WebKit/img/sidebar/conversation_active.png new file mode 100644 index 0000000..93d96df Binary files /dev/null and b/WebKit/img/sidebar/conversation_active.png differ diff --git a/WebKit/img/sidebar/mentions.png b/WebKit/img/sidebar/mentions.png new file mode 100644 index 0000000..a04c705 Binary files /dev/null and b/WebKit/img/sidebar/mentions.png differ diff --git a/WebKit/img/sidebar/mentions_active.png b/WebKit/img/sidebar/mentions_active.png new file mode 100644 index 0000000..407c7a3 Binary files /dev/null and b/WebKit/img/sidebar/mentions_active.png differ diff --git a/WebKit/img/sidebar/profile.png b/WebKit/img/sidebar/profile.png new file mode 100644 index 0000000..9cc7e3a Binary files /dev/null and b/WebKit/img/sidebar/profile.png differ diff --git a/WebKit/img/sidebar/profile_active.png b/WebKit/img/sidebar/profile_active.png new file mode 100644 index 0000000..732d9b6 Binary files /dev/null and b/WebKit/img/sidebar/profile_active.png differ diff --git a/WebKit/img/sidebar/search.png b/WebKit/img/sidebar/search.png new file mode 100644 index 0000000..1ea9d65 Binary files /dev/null and b/WebKit/img/sidebar/search.png differ diff --git a/WebKit/img/sidebar/search_active.png b/WebKit/img/sidebar/search_active.png new file mode 100644 index 0000000..4b946f8 Binary files /dev/null and b/WebKit/img/sidebar/search_active.png differ diff --git a/WebKit/img/sidebar/timeline.png b/WebKit/img/sidebar/timeline.png new file mode 100644 index 0000000..e29ae97 Binary files /dev/null and b/WebKit/img/sidebar/timeline.png differ diff --git a/WebKit/img/sidebar/timeline_active.png b/WebKit/img/sidebar/timeline_active.png new file mode 100644 index 0000000..4de24dd Binary files /dev/null and b/WebKit/img/sidebar/timeline_active.png differ diff --git a/WebKit/img/sidebar/user.png b/WebKit/img/sidebar/user.png new file mode 100644 index 0000000..563c606 Binary files /dev/null and b/WebKit/img/sidebar/user.png differ diff --git a/WebKit/img/sidebar/user_active.png b/WebKit/img/sidebar/user_active.png new file mode 100644 index 0000000..856f62c Binary files /dev/null and b/WebKit/img/sidebar/user_active.png differ diff --git a/WebKit/index.html b/WebKit/index.html index 098642f..f6d8422 100644 --- a/WebKit/index.html +++ b/WebKit/index.html @@ -7,5 +7,11 @@
+ +