Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vmj-qt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
vmj-qt
Commits
21211f65
Commit
21211f65
authored
Dec 06, 2010
by
Dan Pascu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added server tools activity indicator
parent
68fd1ecb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
142 additions
and
3 deletions
+142
-3
accounts.py
blink/accounts.py
+56
-1
servertools-spinner.mng
resources/icons/servertools-spinner.mng
+0
-0
server_tools.ui
resources/server_tools.ui
+86
-2
No files found.
blink/accounts.py
View file @
21211f65
...
...
@@ -14,7 +14,7 @@ from collections import defaultdict
from
PyQt4
import
uic
from
PyQt4.QtCore
import
Qt
,
QAbstractListModel
,
QModelIndex
,
QUrl
,
QVariant
from
PyQt4.QtGui
import
QAction
,
QButtonGroup
,
QComboBox
,
QIcon
,
QMenu
,
QPalette
,
QPixmap
,
QSortFilterProxyModel
,
QStyledItemDelegate
from
PyQt4.QtGui
import
QAction
,
QButtonGroup
,
QComboBox
,
QIcon
,
QMenu
,
Q
Movie
,
Q
Palette
,
QPixmap
,
QSortFilterProxyModel
,
QStyledItemDelegate
from
PyQt4.QtNetwork
import
QNetworkAccessManager
from
PyQt4.QtWebKit
import
QWebView
...
...
@@ -528,6 +528,7 @@ class ServerToolsWebView(QWebView):
self
.
user_agent
=
'blink'
self
.
tab
=
None
self
.
task
=
None
self
.
last_error
=
None
self
.
urlChanged
.
connect
(
self
.
_SH_URLChanged
)
@
property
...
...
@@ -550,8 +551,10 @@ class ServerToolsWebView(QWebView):
if
account
:
notification_center
.
add_observer
(
self
,
sender
=
account
)
self
.
access_manager
.
authenticationRequired
.
disconnect
(
self
.
_SH_AuthenticationRequired
)
self
.
access_manager
.
finished
.
disconnect
(
self
.
_SH_Finished
)
self
.
access_manager
=
QNetworkAccessManager
(
self
)
self
.
access_manager
.
authenticationRequired
.
connect
(
self
.
_SH_AuthenticationRequired
)
self
.
access_manager
.
finished
.
connect
(
self
.
_SH_Finished
)
self
.
page
()
.
setNetworkAccessManager
(
self
.
access_manager
)
account
=
property
(
_get_account
,
_set_account
)
...
...
@@ -578,6 +581,12 @@ class ServerToolsWebView(QWebView):
# authenticated status so that we try again when the page is reloaded.
self
.
authenticated
=
False
def
_SH_Finished
(
self
,
reply
):
if
reply
.
error
()
!=
reply
.
NoError
:
self
.
last_error
=
reply
.
errorString
()
else
:
self
.
last_error
=
None
def
_SH_URLChanged
(
self
,
url
):
query_items
=
dict
((
unicode
(
name
),
unicode
(
value
))
for
name
,
value
in
url
.
queryItems
())
self
.
tab
=
query_items
.
get
(
'tab'
)
or
self
.
tab
...
...
@@ -602,6 +611,10 @@ class ServerToolsWindow(base_class, ui_class):
super
(
ServerToolsWindow
,
self
)
.
__init__
(
parent
)
with
Resources
.
directory
:
self
.
setupUi
(
self
)
self
.
spinner_movie
=
QMovie
(
Resources
.
get
(
'icons/servertools-spinner.mng'
))
self
.
spinner_label
.
setMovie
(
self
.
spinner_movie
)
self
.
spinner_label
.
hide
()
self
.
progress_bar
.
hide
()
while
self
.
tab_widget
.
count
():
self
.
tab_widget
.
removeTab
(
0
)
# remove the tab(s) added in designer
self
.
tab_widget
.
tabBar
()
.
hide
()
...
...
@@ -617,6 +630,10 @@ class ServerToolsWindow(base_class, ui_class):
self
.
model
.
rowsInserted
.
connect
(
self
.
_SH_ModelChanged
)
self
.
model
.
rowsRemoved
.
connect
(
self
.
_SH_ModelChanged
)
self
.
account_button
.
menu
()
.
triggered
.
connect
(
self
.
_SH_AccountButtonMenuTriggered
)
web_view
=
self
.
tab_widget
.
currentWidget
()
web_view
.
loadStarted
.
connect
(
self
.
_SH_WebViewLoadStarted
)
web_view
.
loadFinished
.
connect
(
self
.
_SH_WebViewLoadFinished
)
web_view
.
loadProgress
.
connect
(
self
.
_SH_WebViewLoadProgress
)
def
_SH_AccountButtonMenuTriggered
(
self
,
action
):
view
=
self
.
tab_widget
.
currentWidget
()
...
...
@@ -625,6 +642,44 @@ class ServerToolsWindow(base_class, ui_class):
self
.
tab_widget
.
setTabText
(
self
.
tab_widget
.
currentIndex
(),
account
.
id
)
view
.
load_account_page
(
account
,
tab
=
view
.
tab
,
task
=
view
.
task
)
def
_SH_WebViewLoadStarted
(
self
):
self
.
spinner_label
.
setMovie
(
self
.
spinner_movie
)
self
.
spinner_label
.
show
()
self
.
spinner_movie
.
start
()
self
.
progress_bar
.
setValue
(
0
)
#self.progress_bar.show()
def
_SH_WebViewLoadFinished
(
self
,
load_ok
):
self
.
spinner_movie
.
stop
()
self
.
spinner_label
.
hide
()
self
.
progress_bar
.
hide
()
if
not
load_ok
:
web_view
=
self
.
tab_widget
.
currentWidget
()
icon_path
=
Resources
.
get
(
'icons/invalid.png'
)
error_message
=
web_view
.
last_error
or
'Unknown error'
html
=
"""
<html>
<head>
<style>
.icon { width: 64px; height: 64px; float: left; }
.message { margin-left: 74px; line-height: 64px; vertical-align: middle; }
</style>
</head>
<body>
<img class="icon" src="file:
%
s" />
<div class="message">Failed to load web page: <b>
%
s</b></div>
</body>
</html>
"""
%
(
icon_path
,
error_message
)
web_view
.
loadStarted
.
disconnect
(
self
.
_SH_WebViewLoadStarted
)
web_view
.
loadFinished
.
disconnect
(
self
.
_SH_WebViewLoadFinished
)
web_view
.
setHtml
(
html
)
web_view
.
loadStarted
.
connect
(
self
.
_SH_WebViewLoadStarted
)
web_view
.
loadFinished
.
connect
(
self
.
_SH_WebViewLoadFinished
)
def
_SH_WebViewLoadProgress
(
self
,
percent
):
self
.
progress_bar
.
setValue
(
percent
)
def
_SH_ModelChanged
(
self
,
parent_index
,
start
,
end
):
menu
=
self
.
account_button
.
menu
()
menu
.
clear
()
...
...
resources/icons/servertools-spinner.mng
0 → 100644
View file @
21211f65
File added
resources/server_tools.ui
View file @
21211f65
...
...
@@ -69,7 +69,7 @@
</widget>
</item>
<item>
<widget
class=
"Q
Label"
name=
"account_label
"
>
<widget
class=
"Q
Frame"
name=
"location_frame
"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding"
vsizetype=
"Preferred"
>
<horstretch>
0
</horstretch>
...
...
@@ -77,7 +77,7 @@
</sizepolicy>
</property>
<property
name=
"styleSheet"
>
<string>
Q
Label
{
<string>
Q
Frame#location_frame
{
background: #2060c0;
border-style: outset;
border-width: 1px;
...
...
@@ -89,8 +89,92 @@
padding-right: 2px;
color: white;
}
QWidget {
color: white;
}
</string>
</property>
<property
name=
"frameShape"
>
<enum>
QFrame::NoFrame
</enum>
</property>
<property
name=
"frameShadow"
>
<enum>
QFrame::Plain
</enum>
</property>
<property
name=
"lineWidth"
>
<number>
0
</number>
</property>
<layout
class=
"QHBoxLayout"
name=
"location_layout"
>
<property
name=
"spacing"
>
<number>
7
</number>
</property>
<property
name=
"leftMargin"
>
<number>
0
</number>
</property>
<property
name=
"topMargin"
>
<number>
0
</number>
</property>
<property
name=
"rightMargin"
>
<number>
4
</number>
</property>
<property
name=
"bottomMargin"
>
<number>
0
</number>
</property>
<item>
<widget
class=
"QLabel"
name=
"account_label"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding"
vsizetype=
"Preferred"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget
class=
"QProgressBar"
name=
"progress_bar"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Preferred"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
16777215
</width>
<height>
12
</height>
</size>
</property>
<property
name=
"styleSheet"
>
<string>
QProgressBar {
border: 1px solid white;
border-radius: 2px;
}
QProgressBar::chunk {
background-color: #2060c0;
width: 3px;
margin-right: 1px;
}
</string>
</property>
<property
name=
"value"
>
<number>
30
</number>
</property>
<property
name=
"textVisible"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QLabel"
name=
"spinner_label"
>
<property
name=
"pixmap"
>
<pixmap>
icons/servertools-spinner.mng
</pixmap>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignCenter
</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment