Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Jonathan Wiedemann
MOOC-Workbench
Commits
56f05a19
Commit
56f05a19
authored
Jun 21, 2019
by
Jonathan Wiedemann
Browse files
fix
#22
parent
b750d7fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
InitGui.py
View file @
56f05a19
...
...
@@ -35,7 +35,7 @@ import FreeCAD as app
import
FreeCADGui
as
gui
global
MOOC_VERSION
MOOC_VERSION
=
'V0.1.
3
'
MOOC_VERSION
=
'V0.1.
4
'
moocWBpath
=
os
.
path
.
dirname
(
moocwb_locator
.
__file__
)
moocWBpath_medias
=
os
.
path
.
join
(
moocWBpath
,
'medias'
)
...
...
@@ -61,7 +61,8 @@ class MoocWorkbench ( Workbench ):
def
Activated
(
self
):
"This function is executed when the workbench is activated"
self
.
checkMoocWBVersion
()
import
MoocInformations
MoocInformations
.
checkMoocWBVersion
(
MOOC_VERSION
)
print
(
u
'Activated MoocWorkbench... done'
)
return
...
...
@@ -73,28 +74,5 @@ class MoocWorkbench ( Workbench ):
# this function is mandatory if this is a full python workbench
return
"Gui::PythonWorkbench"
def
checkMoocWBVersion
(
self
):
'''Check version of workbench'''
print
(
u
'Check workbench version...'
)
import
urllib.request
webUrl
=
urllib
.
request
.
urlopen
(
'http://framagit.org/freecad-france/mooc-workbench/raw/master/InitGui.py'
)
for
line
in
webUrl
:
if
'MOOC_VERSION = '
in
str
(
line
,
'utf-8'
):
mooc_version
=
str
(
line
,
'utf-8'
).
split
(
' = '
)
mooc_version
=
mooc_version
[
1
].
split
(
'
\n
'
)
mooc_version
=
mooc_version
[
0
][
1
:
-
1
]
print
(
u
'MOOC last release : '
+
str
(
mooc_version
))
print
(
u
'MOOC current release : '
+
str
(
MOOC_VERSION
))
if
str
(
mooc_version
)
==
MOOC_VERSION
:
print
(
u
'Mooc Workbench is up to date !'
)
else
:
print
(
u
'Please update Mooc Workbench !'
)
from
PySide2
import
QtWidgets
reply
=
QtWidgets
.
QMessageBox
.
information
(
None
,
u
'Mise à jour nécessaire...'
,
u
'''Votre version de l'atelier MOOC est obsolète.
\n
Merci de le mettre à jour à l'aide de l'addon manager.'''
)
# only check the first occurence
break
gui
.
addWorkbench
(
MoocWorkbench
())
MoocInformations.py
0 → 100644
View file @
56f05a19
# coding: utf-8
################################################
#
# InitGui.py
#
# Copyright 2018 Jonathan Wiedemann <contact at freecad-france dot com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
#
################################################
__title__
=
"MOOC Workbench"
__author__
=
"Jonathan Wiedemann"
__url__
=
"http://www.freecadweb.org"
def
checkMoocWBVersion
(
MOOC_VERSION
):
'''Check version of workbench'''
print
(
u
'Check workbench version...'
)
import
urllib.request
webUrl
=
urllib
.
request
.
urlopen
(
'http://framagit.org/freecad-france/mooc-workbench/raw/master/InitGui.py'
)
for
line
in
webUrl
:
if
'MOOC_VERSION = '
in
str
(
line
,
'utf-8'
):
mooc_version
=
str
(
line
,
'utf-8'
).
split
(
' = '
)
mooc_version
=
mooc_version
[
1
].
split
(
'
\n
'
)
mooc_version
=
mooc_version
[
0
][
1
:
-
1
]
print
(
u
'MOOC last release : '
+
str
(
mooc_version
))
print
(
u
'MOOC current release : '
+
str
(
MOOC_VERSION
))
if
str
(
mooc_version
)
==
MOOC_VERSION
:
print
(
u
'Mooc Workbench is up to date !'
)
else
:
print
(
u
'Please update Mooc Workbench !'
)
import
MoocInformations
from
PySide2
import
QtWidgets
reply
=
QtWidgets
.
QMessageBox
.
information
(
None
,
u
'Mise à jour nécessaire...'
,
u
'''Votre version de l'atelier MOOC est obsolète.
\n
Merci de le mettre à jour à l'aide de l'addon manager.'''
)
# only check the first occurence
break
Write
Preview
Supports
Markdown
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