Ali Vakilzade avatar Ali Vakilzade committed ed12380

set window title from project title

Comments (0)

Files changed (3)

runstandalone/guigtk.py

         self.window.connect('destroy', self._quit)
 
         self.webview.load_uri(self.dj_rsa.full_url_address)
+        self.webview.connect('notify::title', self._title_changed)
 
         self.window.show_all()
 
+    def _title_changed(self, webview, gtitle):
+        title = self.webview.get_title()
+        if title != None:
+            self.window.set_title(title)
+
     def run(self):
         self.Gtk.main()
 

runstandalone/guiqt.py

     def __init__(self, dj_rsa):
         self.dj_rsa = dj_rsa
 
+        from PyQt4 import QtCore
         from PyQt4.QtGui import QApplication
-        from PyQt4.QtCore import Qt
         from PyQt4.QtWebKit import QWebView
 
         self.app = QApplication(list())
 
         self.webview = QWebView()
-        self.webview.setWindowState(Qt.WindowMaximized)
+        self.webview.setWindowState(QtCore.Qt.WindowMaximized)
 
+        QtCore.QObject.connect(self.webview,QtCore.SIGNAL("titleChanged (const QString&)"), self._title_changed)
         self.webview.show()
 
+    def _title_changed(self, title):
+        self.webview.setWindowTitle(title)
+
     def run(self):
         from PyQt4.QtCore import QUrl
         self.webview.load(QUrl(self.dj_rsa.full_url_address))

test/testproject/testproject/views.py

 from django.http.response import HttpResponse
 
 def root(request):
-    return HttpResponse('''Hello!
+    return HttpResponse('''
+        <title>Django Run Stand Alone Test project</title>
+        Hello!
         <hr>
         <img src='/static/django.png' />
     ''')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.