Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sl-calendar
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs
gui
sl-calendar
Commits
6d41df40
Commit
6d41df40
authored
5 months ago
by
Paolo Cinquegrana
Browse files
Options
Downloads
Patches
Plain Diff
rinomitato file .py, sostituita la modalita ore con la modalita giornata
parent
2d601778
No related branches found
Branches containing commit
Tags
1.0.1
Tags containing commit
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/SlCalendar.py
+251
-0
251 additions, 0 deletions
src/SlCalendar.py
src/sl-calendar.py
+0
-558
0 additions, 558 deletions
src/sl-calendar.py
with
251 additions
and
558 deletions
src/SlCalendar.py
0 → 100755
+
251
−
0
View file @
6d41df40
#!/usr/bin/python
# carico moduli
import
os
import
sys
import
time
import
PyTango
from
PyQt4.QtCore
import
*
from
PyQt4.QtGui
import
*
import
calendar
calendadevice
=
PyTango
.
DeviceProxy
(
'
sl/laser/calendar_sl.01
'
)
nomishift
=
{
1
:
'
morning
'
,
2
:
'
late
'
,
3
:
'
night
'
}
dataref
=
time
.
localtime
()
listaattivita
=
calendadevice
.
activities
class
MainWindow
(
QTableWidget
):
#tabelle SHOW
def
__init__
(
self
,
parent
=
None
):
super
(
MainWindow
,
self
).
__init__
(
parent
)
self
.
spostamese
=
0
self
.
tabella
=
QTableWidget
()
self
.
tabella
.
setColumnCount
(
3
)
self
.
tabella
.
setHorizontalHeaderLabels
([
'
Morning(7-15)
'
,
'
Late(15-23)
'
,
'
Night(23-7)
'
])
self
.
tabella
.
setRowCount
(
31
)
self
.
mese_label
=
QLabel
(
'
mese
'
)
self
.
mese_label
.
setFont
(
font_medio
)
self
.
mesepiu
=
QPushButton
(
"
>>> Next Month >>>
"
)
self
.
mesepiu
.
clicked
.
connect
(
self
.
futuro
)
self
.
mesemeno
=
QPushButton
(
"
<<< Previous Month <<<
"
)
self
.
mesemeno
.
clicked
.
connect
(
self
.
passato
)
self
.
formato_turni
=
QRadioButton
(
"
Shifts
"
)
self
.
formato_turni
.
clicked
.
connect
(
self
.
sistema3
)
self
.
formato_turni
.
setChecked
(
1
)
self
.
formato_giorno
=
QRadioButton
(
"
Days
"
)
self
.
formato_giorno
.
clicked
.
connect
(
self
.
sistema1
)
self
.
calendario_wiki
=
QPushButton
(
"
open FERMI calendar
"
)
self
.
calendario_wiki
.
clicked
.
connect
(
self
.
fermical
)
self
.
applica
=
QPushButton
(
"
Apply Month
"
)
self
.
applica
.
clicked
.
connect
(
self
.
fallo
)
self
.
riempimese_label
=
QLabel
(
'
fill month with:
'
)
self
.
riempimese_box
=
QComboBox
()
self
.
riempimese_box
.
addItem
(
'
Unknown
'
)
for
attivita
in
range
(
len
(
listaattivita
)):
self
.
riempimese_box
.
addItem
(
listaattivita
[
attivita
])
self
.
riempimese_tasto
=
QPushButton
(
"
Fill
"
)
self
.
riempimese_tasto
.
clicked
.
connect
(
self
.
meseuniforme
)
#
lo
=
QGridLayout
()
lo
.
addWidget
(
self
.
mesemeno
,
0
,
0
)
lo
.
addWidget
(
self
.
mese_label
,
0
,
1
)
lo
.
addWidget
(
self
.
mesepiu
,
0
,
2
)
lo
.
addWidget
(
self
.
formato_turni
,
1
,
0
)
lo
.
addWidget
(
self
.
formato_giorno
,
1
,
1
)
lo
.
addWidget
(
self
.
calendario_wiki
,
1
,
2
)
lo
.
addWidget
(
self
.
riempimese_label
,
2
,
0
)
lo
.
addWidget
(
self
.
riempimese_box
,
2
,
1
)
lo
.
addWidget
(
self
.
riempimese_tasto
,
2
,
2
)
lo
.
addWidget
(
self
.
tabella
,
3
,
0
,
1
,
3
)
lo
.
addWidget
(
self
.
applica
,
4
,
0
,
1
,
3
)
self
.
setLayout
(
lo
)
self
.
setWindowTitle
(
"
SEED CALENDAR
"
)
self
.
setStyleSheet
(
"
background-color: rgb(230, 255, 255)
"
)
self
.
resize
(
300
,
800
)
self
.
inizializzazione
()
def
inizializzazione
(
self
):
mese_num
=
time
.
localtime
().
tm_mon
scritta_mese
=
calendar
.
month_name
[
mese_num
+
self
.
spostamese
]
+
'
'
+
time
.
ctime
().
split
(
'
'
)[
-
1
]
self
.
mese_label
.
setText
(
scritta_mese
)
quantigiorni
=
calendar
.
monthrange
(
int
(
time
.
ctime
().
split
(
'
'
)[
-
1
]),
mese_num
+
self
.
spostamese
)
self
.
tabella
.
setRowCount
(
quantigiorni
[
1
])
if
self
.
formato_turni
.
isChecked
():
for
giorni
in
range
(
quantigiorni
[
1
]):
for
turni
in
range
(
3
):
self
.
casellagenerica
=
QComboBox
()
self
.
casellagenerica
.
addItem
(
'
Unknown
'
)
for
attivita
in
range
(
len
(
listaattivita
)):
self
.
casellagenerica
.
addItem
(
listaattivita
[
attivita
])
if
mese_num
+
self
.
spostamese
<
10
and
giorni
+
1
<
10
:
componistringa
=
time
.
ctime
().
split
(
'
'
)[
-
1
]
+
'
-0
'
+
str
(
mese_num
+
self
.
spostamese
)
+
'
-0
'
+
str
(
giorni
+
1
)
+
'
'
+
nomishift
[
turni
+
1
]
elif
mese_num
+
self
.
spostamese
<
10
and
giorni
+
1
>
10
:
componistringa
=
time
.
ctime
().
split
(
'
'
)[
-
1
]
+
'
-0
'
+
str
(
mese_num
+
self
.
spostamese
)
+
'
-
'
+
str
(
giorni
+
1
)
+
'
'
+
nomishift
[
turni
+
1
]
elif
mese_num
+
self
.
spostamese
>
10
and
giorni
+
1
<
10
:
componistringa
=
time
.
ctime
().
split
(
'
'
)[
-
1
]
+
'
-
'
+
str
(
mese_num
+
self
.
spostamese
)
+
'
-0
'
+
str
(
giorni
+
1
)
+
'
'
+
nomishift
[
turni
+
1
]
else
:
componistringa
=
time
.
ctime
().
split
(
'
'
)[
-
1
]
+
'
-
'
+
str
(
mese_num
+
self
.
spostamese
)
+
'
-
'
+
str
(
giorni
+
1
)
+
'
'
+
nomishift
[
turni
+
1
]
#print(componistringa)
cosapensadifare
=
calendadevice
.
command_inout
(
'
GetShiftActivity
'
,
componistringa
)
#print(cosapensadifare)
if
cosapensadifare
==
'
Unknown
'
:
self
.
casellagenerica
.
setCurrentIndex
(
0
)
#print('0')
elif
cosapensadifare
==
'
SHUTDOWN
'
:
self
.
casellagenerica
.
setCurrentIndex
(
1
)
#print('1')
elif
cosapensadifare
==
'
CUSTOM
'
:
self
.
casellagenerica
.
setCurrentIndex
(
2
)
#print('2')
elif
cosapensadifare
==
'
FEL1OPA
'
:
self
.
casellagenerica
.
setCurrentIndex
(
3
)
#print('3')
elif
cosapensadifare
==
'
FEL1OPA_LR
'
:
self
.
casellagenerica
.
setCurrentIndex
(
4
)
#print('4')
elif
cosapensadifare
==
'
FEL1THG
'
:
self
.
casellagenerica
.
setCurrentIndex
(
5
)
#print('5')
elif
cosapensadifare
==
'
FEL1EEHG
'
:
self
.
casellagenerica
.
setCurrentIndex
(
6
)
#print('6')
elif
cosapensadifare
==
'
FEL2OPA
'
:
self
.
casellagenerica
.
setCurrentIndex
(
7
)
#print('7')
elif
cosapensadifare
==
'
FEL2THG
'
:
self
.
casellagenerica
.
setCurrentIndex
(
8
)
#print('8')
else
:
print
(
'
no
'
)
self
.
tabella
.
setCellWidget
(
giorni
,
turni
,
self
.
casellagenerica
)
elif
self
.
formato_giorno
.
isChecked
():
for
giorni
in
range
(
quantigiorni
[
1
]):
self
.
casellagenerica
=
QComboBox
()
self
.
casellagenerica
.
addItem
(
'
Unknown
'
)
for
attivita
in
range
(
len
(
listaattivita
)):
self
.
casellagenerica
.
addItem
(
listaattivita
[
attivita
])
if
mese_num
<
10
and
giorni
+
1
<
10
:
componistringa
=
time
.
ctime
().
split
(
'
'
)[
-
1
]
+
'
-0
'
+
str
(
mese_num
+
self
.
spostamese
)
+
'
-0
'
+
str
(
giorni
+
1
)
+
'
morning
'
elif
mese_num
<
10
and
giorni
+
1
>
10
:
componistringa
=
time
.
ctime
().
split
(
'
'
)[
-
1
]
+
'
-0
'
+
str
(
mese_num
+
self
.
spostamese
)
+
'
-
'
+
str
(
giorni
+
1
)
+
'
morning
'
elif
mese_num
>
10
and
giorni
+
1
<
10
:
componistringa
=
time
.
ctime
().
split
(
'
'
)[
-
1
]
+
'
-
'
+
str
(
mese_num
+
self
.
spostamese
)
+
'
-0
'
+
str
(
giorni
+
1
)
+
'
morning
'
else
:
componistringa
=
time
.
ctime
().
split
(
'
'
)[
-
1
]
+
'
-
'
+
str
(
mese_num
+
self
.
spostamese
)
+
'
-
'
+
str
(
giorni
+
1
)
+
'
morning
'
# print(componistringa)
cosapensadifare
=
calendadevice
.
command_inout
(
'
GetShiftActivity
'
,
componistringa
)
#print(cosapensadifare)
if
cosapensadifare
==
'
Unknown
'
:
self
.
casellagenerica
.
setCurrentIndex
(
0
)
#print('0')
elif
cosapensadifare
==
'
SHUTDOWN
'
:
self
.
casellagenerica
.
setCurrentIndex
(
1
)
#print('1')
elif
cosapensadifare
==
'
CUSTOM
'
:
self
.
casellagenerica
.
setCurrentIndex
(
2
)
#print('2')
elif
cosapensadifare
==
'
FEL1OPA
'
:
self
.
casellagenerica
.
setCurrentIndex
(
3
)
#print('3')
elif
cosapensadifare
==
'
FEL1OPA_LR
'
:
self
.
casellagenerica
.
setCurrentIndex
(
4
)
#print('4')
elif
cosapensadifare
==
'
FEL1THG
'
:
self
.
casellagenerica
.
setCurrentIndex
(
5
)
#print('5')
elif
cosapensadifare
==
'
FEL1EEHG
'
:
self
.
casellagenerica
.
setCurrentIndex
(
6
)
#print('6')
elif
cosapensadifare
==
'
FEL2OPA
'
:
self
.
casellagenerica
.
setCurrentIndex
(
7
)
#print('7')
elif
cosapensadifare
==
'
FEL2THG
'
:
self
.
casellagenerica
.
setCurrentIndex
(
8
)
#print('8')
else
:
print
(
'
no
'
)
self
.
tabella
.
setCellWidget
(
giorni
,
0
,
self
.
casellagenerica
)
self
.
tabella
.
resizeColumnsToContents
()
def
futuro
(
self
):
self
.
spostamese
=
self
.
spostamese
+
1
self
.
inizializzazione
()
def
passato
(
self
):
self
.
spostamese
=
self
.
spostamese
-
1
self
.
inizializzazione
()
def
meseuniforme
(
self
):
scelta
=
self
.
riempimese_box
.
currentIndex
()
# print(scelta)
for
righe
in
range
(
self
.
tabella
.
rowCount
()):
for
colonne
in
range
(
self
.
tabella
.
columnCount
()):
self
.
tabella
.
cellWidget
(
righe
,
colonne
).
setCurrentIndex
(
scelta
)
def
sistema3
(
self
):
self
.
tabella
.
setColumnCount
(
3
)
self
.
tabella
.
setHorizontalHeaderLabels
([
'
Morning(7-15)
'
,
'
Late(15-23)
'
,
'
Night(23-7)
'
])
self
.
inizializzazione
()
#print('3')
def
sistema1
(
self
):
self
.
tabella
.
setColumnCount
(
1
)
self
.
tabella
.
setHorizontalHeaderLabels
([
'
Day
'
])
self
.
inizializzazione
()
#print('24')
def
fermical
(
self
):
os
.
system
(
'
firefox http://acswww/Fermi
'
)
def
fallo
(
self
):
controllo
=
self
.
tabella
.
columnCount
()
if
controllo
<
3
:
stringacomando
=
[]
for
righe
in
range
(
self
.
tabella
.
rowCount
()):
if
str
(
self
.
tabella
.
cellWidget
(
righe
,
0
).
currentText
())
!=
'
Unknown
'
:
#print(self.tabella.cellWidget(righe, colonne).currentText())
#'time=YYYY-MM-DD shiftname;activity=..'
if
time
.
localtime
().
tm_mon
+
self
.
spostamese
<
10
:
mese
=
'
-0
'
+
str
(
time
.
localtime
().
tm_mon
+
self
.
spostamese
)
else
:
mese
=
'
-
'
+
str
(
time
.
localtime
().
tm_mon
+
self
.
spostamese
)
if
str
(
righe
+
1
)
<
10
:
giorno
=
'
-0
'
+
str
(
righe
+
1
)
else
:
giorno
=
'
-
'
+
str
(
righe
+
1
)
stringacomando
.
append
(
'
time=
'
+
time
.
ctime
().
split
(
'
'
)[
-
1
]
+
mese
+
giorno
+
'
morning;activity=
'
+
str
(
self
.
tabella
.
cellWidget
(
righe
,
0
).
currentText
()))
stringacomando
.
append
(
'
time=
'
+
time
.
ctime
().
split
(
'
'
)[
-
1
]
+
mese
+
giorno
+
'
late;activity=
'
+
str
(
self
.
tabella
.
cellWidget
(
righe
,
0
).
currentText
()))
stringacomando
.
append
(
'
time=
'
+
time
.
ctime
().
split
(
'
'
)[
-
1
]
+
mese
+
giorno
+
'
night;activity=
'
+
str
(
self
.
tabella
.
cellWidget
(
righe
,
0
).
currentText
()))
#print(stringacomando)
else
:
print
(
'
ok
'
)
print
(
stringacomando
)
calendadevice
.
command_inout
(
'
LoadShiftActivities
'
,
stringacomando
)
else
:
stringacomando
=
[]
for
righe
in
range
(
self
.
tabella
.
rowCount
()):
for
colonne
in
range
(
controllo
):
if
str
(
self
.
tabella
.
cellWidget
(
righe
,
colonne
).
currentText
())
!=
'
Unknown
'
:
#print(self.tabella.cellWidget(righe, colonne).currentText())
#'time=YYYY-MM-DD shiftname;activity=..'
if
time
.
localtime
().
tm_mon
+
self
.
spostamese
<
10
:
mese
=
'
-0
'
+
str
(
time
.
localtime
().
tm_mon
+
self
.
spostamese
)
else
:
mese
=
'
-
'
+
str
(
time
.
localtime
().
tm_mon
+
self
.
spostamese
)
if
str
(
righe
+
1
)
<
10
:
giorno
=
'
-0
'
+
str
(
righe
+
1
)
else
:
giorno
=
'
-
'
+
str
(
righe
+
1
)
stringacomando
.
append
(
'
time=
'
+
time
.
ctime
().
split
(
'
'
)[
-
1
]
+
mese
+
giorno
+
'
'
+
nomishift
[
colonne
+
1
]
+
'
;activity=
'
+
str
(
self
.
tabella
.
cellWidget
(
righe
,
colonne
).
currentText
()))
#print(stringacomando)
else
:
print
(
'
ok
'
)
print
(
stringacomando
)
calendadevice
.
command_inout
(
'
LoadShiftActivities
'
,
stringacomando
)
#####################
app
=
QApplication
(
sys
.
argv
)
app
.
setApplicationName
(
"
SEED CALENDAR
"
)
font_medio
=
QFont
(
"
Arial
"
,
18
,
-
1
,
False
)
application
=
MainWindow
()
application
.
show
()
sys
.
exit
(
app
.
exec_
())
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/sl-calendar.py
deleted
100755 → 0
+
0
−
558
View file @
2d601778
This diff is collapsed.
Click to expand it.
Preview
0%
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