Added webkit inspector to menu
This commit is contained in:
parent
3d1768540d
commit
f3bb2efbc0
5 changed files with 53 additions and 13 deletions
|
@ -49,7 +49,10 @@ class Bungloo:
|
||||||
self.init_web_views()
|
self.init_web_views()
|
||||||
|
|
||||||
def init_web_views(self):
|
def init_web_views(self):
|
||||||
self.timeline = Windows.Timeline(self)
|
if not hasattr(self, "timeline"):
|
||||||
|
self.timeline = Windows.Timeline(self)
|
||||||
|
else:
|
||||||
|
self.timeline.evaluateJavaScript("start('timeline')")
|
||||||
self.timeline.show()
|
self.timeline.show()
|
||||||
self.find_entity = Windows.FindEntity(self)
|
self.find_entity = Windows.FindEntity(self)
|
||||||
|
|
||||||
|
@ -78,9 +81,9 @@ class Bungloo:
|
||||||
|
|
||||||
def log_out(self):
|
def log_out(self):
|
||||||
self.oauth_implementation.log_out()
|
self.oauth_implementation.log_out()
|
||||||
self.timeline.close()
|
self.timeline.hide()
|
||||||
self.preferences.show()
|
self.preferences.show()
|
||||||
#self.timeline.evaluateJavaScript("bungloo.sidebar.logout()")
|
self.timeline.evaluateJavaScript("bungloo.sidebar.logout()")
|
||||||
|
|
||||||
|
|
||||||
class Controller(QtCore.QObject):
|
class Controller(QtCore.QObject):
|
||||||
|
@ -142,12 +145,8 @@ class Controller(QtCore.QObject):
|
||||||
|
|
||||||
@QtCore.pyqtSlot(int)
|
@QtCore.pyqtSlot(int)
|
||||||
def unreadMentions(self, count):
|
def unreadMentions(self, count):
|
||||||
i = int(count)
|
script = "bungloo.sidebar.setUnreadMentions({});".format(int(count))
|
||||||
if i > 0:
|
self.app.timeline.evaluateJavaScript(script)
|
||||||
self.app.timeline.set_window_title("Bungloo (^" + str(i) + ")")
|
|
||||||
else:
|
|
||||||
self.app.timeline.set_window_title("Bungloo")
|
|
||||||
self.app.timeline.evaluateJavaScript("bungloo.mentions.unread_mentions = 0;")
|
|
||||||
|
|
||||||
@QtCore.pyqtSlot(str, str, str, str)
|
@QtCore.pyqtSlot(str, str, str, str)
|
||||||
def notificateUserAboutMentionFromNameWithPostIdAndEntity(self, text, name, post_id, entity):
|
def notificateUserAboutMentionFromNameWithPostIdAndEntity(self, text, name, post_id, entity):
|
||||||
|
|
|
@ -42,7 +42,6 @@ class WebViewCreator(QtWebKit.QWebView):
|
||||||
self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
|
self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
|
||||||
self.customContextMenuRequested.connect(self.context_menu_requested)
|
self.customContextMenuRequested.connect(self.context_menu_requested)
|
||||||
self.actions = []
|
self.actions = []
|
||||||
QtWebKit.QWebSettings.globalSettings().setAttribute(QtWebKit.QWebSettings.DeveloperExtrasEnabled, True)
|
|
||||||
|
|
||||||
def copy_link():
|
def copy_link():
|
||||||
self.page().triggerAction(QtWebKit.QWebPage.CopyLinkToClipboard)
|
self.page().triggerAction(QtWebKit.QWebPage.CopyLinkToClipboard)
|
||||||
|
|
|
@ -103,17 +103,17 @@ class Timeline:
|
||||||
def initUI(self):
|
def initUI(self):
|
||||||
menubar = self.window.menuBar()
|
menubar = self.window.menuBar()
|
||||||
|
|
||||||
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(self.app.controller.openNewMessageWidow)
|
||||||
|
|
||||||
findEntityAction = QtGui.QAction("&Open profile for entity ...", self.window)
|
findEntityAction = QtGui.QAction("&Open Profile for Entity ...", self.window)
|
||||||
findEntityAction.setShortcut("Ctrl+u")
|
findEntityAction.setShortcut("Ctrl+u")
|
||||||
findEntityAction.setStatusTip("Find entity and open its profile view")
|
findEntityAction.setStatusTip("Find entity and open its profile view")
|
||||||
findEntityAction.triggered.connect(self.app.find_entity_show)
|
findEntityAction.triggered.connect(self.app.find_entity_show)
|
||||||
|
|
||||||
logOutAction = QtGui.QAction("&Log out", self.window)
|
logOutAction = QtGui.QAction("&Log Out", self.window)
|
||||||
logOutAction.setStatusTip("Log out from this entity")
|
logOutAction.setStatusTip("Log out from this entity")
|
||||||
logOutAction.triggered.connect(self.app.log_out)
|
logOutAction.triggered.connect(self.app.log_out)
|
||||||
|
|
||||||
|
@ -165,8 +165,13 @@ class Timeline:
|
||||||
aboutAction.setStatusTip("Open about page in Webbrowser")
|
aboutAction.setStatusTip("Open about page in Webbrowser")
|
||||||
aboutAction.triggered.connect(self.app.open_about)
|
aboutAction.triggered.connect(self.app.open_about)
|
||||||
|
|
||||||
|
developerExtrasAction = QtGui.QAction("&Developer Extras", self.window)
|
||||||
|
developerExtrasAction.setStatusTip("Activate webkit inspector")
|
||||||
|
developerExtrasAction.triggered.connect(self.developer_extras)
|
||||||
|
|
||||||
helpMenu = menubar.addMenu("&Help")
|
helpMenu = menubar.addMenu("&Help")
|
||||||
helpMenu.addAction(aboutAction)
|
helpMenu.addAction(aboutAction)
|
||||||
|
helpMenu.addAction(developerExtrasAction)
|
||||||
|
|
||||||
def show(self):
|
def show(self):
|
||||||
self.window.show()
|
self.window.show()
|
||||||
|
@ -188,6 +193,9 @@ class Timeline:
|
||||||
def evaluateJavaScript(self, func):
|
def evaluateJavaScript(self, func):
|
||||||
return self.webView.page().mainFrame().evaluateJavaScript(func)
|
return self.webView.page().mainFrame().evaluateJavaScript(func)
|
||||||
|
|
||||||
|
def developer_extras(self, widget):
|
||||||
|
QtWebKit.QWebSettings.globalSettings().setAttribute(QtWebKit.QWebSettings.DeveloperExtrasEnabled, True)
|
||||||
|
|
||||||
|
|
||||||
class Oauth:
|
class Oauth:
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,23 @@ a {
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#sidebar .unread_mentions {
|
||||||
|
color: white;
|
||||||
|
background: red;
|
||||||
|
border: 2px solid white;
|
||||||
|
border-radius: 1em;
|
||||||
|
box-shadow: 0 0 1em black;
|
||||||
|
padding: 0 0.3em;
|
||||||
|
position: absolute;
|
||||||
|
top: 100px;
|
||||||
|
right: 10px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sidebar .unread_mentions:empty {
|
||||||
|
/*display: none;*/
|
||||||
|
}
|
||||||
|
|
||||||
#content {
|
#content {
|
||||||
margin-left: 62px;
|
margin-left: 62px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,11 @@ function(HostApp, Paths, Cache) {
|
||||||
this.body.appendChild(this.menu.entityProfile);
|
this.body.appendChild(this.menu.entityProfile);
|
||||||
this.body.appendChild(this.menu.search);
|
this.body.appendChild(this.menu.search);
|
||||||
|
|
||||||
|
this.unreadMentionsSpan = document.createElement("span");
|
||||||
|
this.unreadMentionsSpan.className = "unread_mentions";
|
||||||
|
this.menu.mentions.appendChild(this.unreadMentionsSpan);
|
||||||
|
this.setUnreadMentions(0);
|
||||||
|
|
||||||
document.getElementById("sidebar").appendChild(this.body);
|
document.getElementById("sidebar").appendChild(this.body);
|
||||||
|
|
||||||
this.setEntityAvatar();
|
this.setEntityAvatar();
|
||||||
|
@ -158,6 +163,15 @@ function(HostApp, Paths, Cache) {
|
||||||
img.src = img.src_active;
|
img.src = img.src_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Sidebar.prototype.setUnreadMentions = function(count) {
|
||||||
|
this.unreadMentionsSpan.innerHTML = count == 0 ? "" : count;
|
||||||
|
if (count > 0) {
|
||||||
|
$(this.unreadMentionsSpan).show();
|
||||||
|
} else {
|
||||||
|
$(this.unreadMentionsSpan).hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Sidebar.prototype.onEntity = function() {
|
Sidebar.prototype.onEntity = function() {
|
||||||
bungloo.entityProfile.showProfileForEntity();
|
bungloo.entityProfile.showProfileForEntity();
|
||||||
this.onEntityProfile();
|
this.onEntityProfile();
|
||||||
|
@ -191,6 +205,9 @@ function(HostApp, Paths, Cache) {
|
||||||
bungloo.conversation.logout();
|
bungloo.conversation.logout();
|
||||||
bungloo.entityProfile.logout();
|
bungloo.entityProfile.logout();
|
||||||
bungloo.search.logout();
|
bungloo.search.logout();
|
||||||
|
|
||||||
|
document.getElementById("sidebar").innerHTML = "";
|
||||||
|
document.getElementById("content").innerHTML = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return Sidebar;
|
return Sidebar;
|
||||||
|
|
Reference in a new issue