# -*- coding: utf-8 -*-
"""
Created on Thu Jul 16 09:02:41 2015
@author: Administrator
"""
from
PyQt4
.
QtGui
import
*
from
PyQt4
.
QtCore
import
*
from
DateDialog
import
*
import
sys
class
MainWindow
(
QDialog
):
def
__init__
(
self
,
parent
=
None
):
QWidget
.
__init__
(
self
)
self
.
resize
(
300
,
200
)
open_btn
=
QPushButton
(
'OPEN'
)
self
.
le_btn
=
QLineEdit
(
self
)
self
.
le1_btn
=
QLineEdit
(
self
)
self
.
le2_btn
=
QLineEdit
(
self
)
self
.
le3_btn
=
QLineEdit
(
self
)
self
.
connect
(
open_btn
,
SIGNAL
(
'clicked()'
),
self
.
openDialog
)
grid
=
QGridLayout
()
grid
.
addWidget
(
self
.
le_btn
)
grid
.
addWidget
(
self
.
le1_btn
)
grid
.
addWidget
(
self
.
le2_btn
)
grid
.
addWidget
(
self
.
le3_btn
)
grid
.
addWidget
(
open_btn
)
self
.
setLayout
(
grid
)
self
.
setWindowTitle
(
'main windows'
)
def
openDialog
(
self
):
dialog
=
DateDialog
(
self
)
self
.
connect
(
dialog
,
SIGNAL
(
'sendDate(QDateTime)'
),
self
,
SLOT
(
'receiveDate(QDateTime)'
))
self
.
connect
(
dialog
,
SIGNAL
(
'sendDate(QDateTime)'
),
self
,
SLOT
(
'copyDate(QDateTime)'
))
self
.
connect
(
dialog
.
datetime
,
SIGNAL
(
'dateTimeChanged(QDateTime)'
),
self
,
SLOT
(
'getDate(QDateTime)'
))
#self.connect(dialog,SIGNAL('Signal_OneParameter_Overload(str)'),self,SLOT('getStrDate(str)'))
dialog
.
Signal_OneParameter
.
connect
(
self
.
getStrDate
)
dialog
.
show
()
@pyqtSlot
(
str
)
def
getStrDate
(
self
,
dateStr
):
self
.
le3_btn
.
setText
(
dateStr
)
@pyqtSlot
(
QDateTime
)
def
receiveDate
(
self
,
date
):
self
.
le_btn
.
setText
(
date
.
toString
())
@pyqtSlot
(
QDateTime
)
def
getDate
(
self
,
date
):
self
.
le2_btn
.
setText
(
date
.
toString
())
@pyqtSlot
(
QDateTime
)
def
copyDate
(
self
,
date
):
self
.
le1_btn
.
setText
(
date
.
toString
())
app
=
QApplication
(
sys
.
argv
)
app
.
setFont
(
QFont
(
"Helvetica"
,
16
))
main
=
MainWindow
()
main
.
show
()
sys
.
exit
(
app
.
exec_
())