fixing problems with new post
This commit is contained in:
parent
3fff224924
commit
16d7016e29
10 changed files with 851 additions and 807 deletions
|
@ -171,13 +171,12 @@ class Controller(QtCore.QObject):
|
|||
pass
|
||||
|
||||
@QtCore.pyqtSlot(str)
|
||||
def openNewMessageWidow(self, is_private=False, string=""):
|
||||
string = str(string)
|
||||
self.openNewMessageWindowInReplyTostatusIdwithStringIsPrivate(None, None, string, is_private)
|
||||
def openNewMessageWidow(self):
|
||||
self.openNewMessageWindowInReplyTostatus(None)
|
||||
|
||||
@QtCore.pyqtSlot(str, str, str, bool)
|
||||
def openNewMessageWindowInReplyTostatusIdwithStringIsPrivate(self, entity, status_id, string, is_private):
|
||||
new_message_window = Windows.NewPost(self.app, string, "[]", is_private)
|
||||
def openNewMessageWindowInReplyTostatus(self, status_string):
|
||||
new_message_window = Windows.NewPost(self.app)
|
||||
new_message_window.show()
|
||||
new_message_window.setAttribute(QtCore.Qt.WA_DeleteOnClose)
|
||||
self.app.new_message_windows.append(new_message_window)
|
||||
|
|
|
@ -329,11 +329,12 @@ class FindEntity(QtGui.QDialog):
|
|||
|
||||
|
||||
class NewPost(Helper.RestorableWindow):
|
||||
def __init__(self, app, string, mentions, is_private):
|
||||
def __init__(self, app, string=None, mentions="[]", is_private=False, post_id=None):
|
||||
self.app = app
|
||||
self.string = string
|
||||
self.mentions = mentions
|
||||
self.is_private = is_private
|
||||
self.post_id = post_id
|
||||
|
||||
Helper.RestorableWindow.__init__(self, "newpost", self.app)
|
||||
self.activateWindow()
|
||||
|
@ -414,7 +415,11 @@ class NewPost(Helper.RestorableWindow):
|
|||
if self.is_private:
|
||||
is_private = "true"
|
||||
|
||||
callback = "function() { bungloo.newpost.setString('%s'); bungloo.newpost.setIsPrivate(%s); bungloo.newpost.setMentions(%s);}" % (self.string, is_private, self.mentions)
|
||||
post_id = ""
|
||||
if self.post_id:
|
||||
post_id = self.post_id
|
||||
|
||||
callback = "function() { bungloo.newpost.setString('%s'); bungloo.newpost.setIsPrivate(%s); bungloo.newpost.setMentions(%s); bungloo.newPostAction.setPostId(%s); }" % (self.string, is_private, self.mentions, post_id)
|
||||
|
||||
script = "function HostAppGo() { start('newpost', " + callback + "); }"
|
||||
self.webView.page().mainFrame().evaluateJavaScript(script)
|
||||
|
@ -425,6 +430,11 @@ class NewPost(Helper.RestorableWindow):
|
|||
self.webView.page().mainFrame().evaluateJavaScript(script)
|
||||
|
||||
def sendMessage(self):
|
||||
script = "bungloo.newpost.send()"
|
||||
self.webView.page().mainFrame().evaluateJavaScript(script)
|
||||
self.close()
|
||||
|
||||
"""
|
||||
count = len(self.textInput.toPlainText())
|
||||
if count > 0 and count <= 256:
|
||||
message = Helper.PostModel()
|
||||
|
@ -438,6 +448,7 @@ class NewPost(Helper.RestorableWindow):
|
|||
self.close()
|
||||
else:
|
||||
QtGui.qApp.beep()
|
||||
"""
|
||||
|
||||
def openFileDialog(self):
|
||||
fileNamePath = QtGui.QFileDialog.getOpenFileName(self, "Choose a image", "", "Images (*.png *.gif *.jpg *.jpeg)")
|
||||
|
|
Reference in a new issue