Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Commander
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
INS Courses
AutPy
Commander
Commits
8393735d
Commit
8393735d
authored
3 years ago
by
Florian Bruhin
Browse files
Options
Downloads
Patches
Plain Diff
git fetcher: Try adding connectivity tracking
parent
14ce7e5d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
commander/gui/git.py
+18
-0
18 additions, 0 deletions
commander/gui/git.py
with
18 additions
and
0 deletions
commander/gui/git.py
+
18
−
0
View file @
8393735d
...
...
@@ -7,6 +7,7 @@ import logging
from
PyQt6.QtCore
import
pyqtSlot
,
pyqtSignal
,
QObject
,
QTimer
,
QProcess
,
Qt
from
PyQt6.QtGui
import
QFont
from
PyQt6.QtWidgets
import
QTableWidget
,
QTableWidgetItem
,
QWidget
from
PyQt6.QtNetwork
import
QNetworkInformation
from
commander.gui
import
utils
...
...
@@ -68,8 +69,25 @@ class GitFetcher(QObject):
self
.
timer
.
setInterval
(
self
.
INTERVAL
)
self
.
timer
.
timeout
.
connect
(
self
.
on_timeout
)
loaded
=
QNetworkInformation
.
load
(
QNetworkInformation
.
Feature
.
Reachability
)
if
loaded
:
QNetworkInformation
.
instance
().
reachabilityChanged
.
connect
(
self
.
_on_reachability_changed
)
self
.
_had_updates
=
False
def
_on_reachability_changed
(
self
,
reachability
:
QNetworkInformation
.
Reachability
)
->
None
:
is_online
=
reachability
==
QNetworkInformation
.
Reachability
.
Online
msg
=
f
"
Network reachability changed (
{
reachability
}
)
"
if
is_online
and
not
self
.
timer
.
isActive
():
logging
.
info
(
f
"
{
msg
}
, resuming git fetcher
"
)
self
.
status_message
.
emit
(
None
)
self
.
timer
.
start
()
elif
not
is_online
:
logging
.
info
(
f
"
{
msg
}
, pausing git fetcher
"
)
self
.
status_message
.
emit
(
"
Paused (not online)
"
)
self
.
timer
.
stop
()
def
start
(
self
):
self
.
on_timeout
()
self
.
timer
.
start
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment