Exemplo n.º 1
0
Arquivo: ui.py Projeto: hcit/pyqt
	def __init__( self ):
		QForm.__init__( self )
		self.setWindowTitle( 'Report' + ' - ' + DBConf.get( 'appname' ) )
		self.setWindowTitle( 'Preferences' + ' - ' + DBConf.get( 'appname' ) )
		self.resize( 450, 250 )
		self.move( 350, 350 )
		
		grid = QtGui.QGridLayout()
		n = 0
		for key, value in DBConf.list():
			grid.addWidget( QtGui.QLabel( key ), n, 0 )
			grid.addWidget( self.lineEditField( key, str( value ) ), n, 1 )
			n += 1
		
		self.submit = QtGui.QPushButton( 'Save', self )
		self.submit.clicked.connect( lambda: QHelper.master().emit( QtCore.SIGNAL( 'preferencesSubmit' ) ) )
		
		self.cancel = QtGui.QPushButton( 'Cancel', self )
		self.cancel.clicked.connect( lambda: QHelper.master().emit( QtCore.SIGNAL( 'preferencesCancel' ) ) )
		
		hbox = QtGui.QHBoxLayout()
		hbox.addStretch( 1 )
		hbox.addWidget( self.submit )
		hbox.addWidget( self.cancel )
		
		buttons = QtGui.QWidget()
		buttons.setLayout( hbox )
		
		grid.addWidget( buttons, n, 0, 1 ,2 )
			
		self.setLayout( grid )
		
		self.connect( QHelper.master(), QtCore.SIGNAL( 'preferencesSubmit' ), self.preferencesSubmitCallback )
		self.connect( QHelper.master(), QtCore.SIGNAL( 'preferencesCancel' ), self.preferencesCancelCallback )
Exemplo n.º 2
0
Arquivo: ui.py Projeto: hcit/pyqt
	def sendMessageCallback( self, contact, message ):
		QHelper.log( '::CONNECT:QChatDialog:sendMessage', contact, message )
		if not self.messagesTime.get( contact, None ): self.messagesTime[contact] = []
		if not self.messagesList.get( contact, None ): self.messagesList[contact] = {}
		DBHistory.set( DBConf.get( 'username' ), contact, message )
		ts = time.time()
		self.messagesTime[contact].append( str( ts ) )
		self.messagesList[contact][str( ts )] = { 'ts':str( ts ), 'sender':DBConf.get( 'username' ), 'recipient':contact, 'message':message }
		self.message( str( ts ), DBConf.get( 'username' ), message )
Exemplo n.º 3
0
Arquivo: ui.py Projeto: hcit/pyqt
	def __init__( self ):
		QForm.__init__( self )
		self.setWindowTitle( 'Login' + ' - ' + DBConf.get( 'appname' ) )
		self.resize( 450, 200 )
		self.move( 350, 350 )
		
		grid = QtGui.QGridLayout()
		
		self.heading = QtGui.QLabel( 'Please enter your login and password' )
		grid.addWidget( self.heading, 0, 0, 1, 2 )
		
		self.status = QtGui.QLabel( '' )
		grid.addWidget( self.status, 1, 0, 1, 2 )
		
		grid.addWidget( QtGui.QLabel( 'username' ), 2, 0 )
		grid.addWidget( self.lineEditField( 'username', DBConf.get( 'username' ), 'username' ), 2, 1 )
		
		grid.addWidget( QtGui.QLabel( 'password' ), 3, 0 )
		grid.addWidget( self.lineEditField( 'passwd', DBConf.get( 'passwd' ), 'password' ), 3, 1 )
		
		self.submit = QtGui.QPushButton( 'Login', self )
		self.submit.clicked.connect( lambda: QHelper.master().emit( QtCore.SIGNAL( 'loginSubmit' ), QHelper.getValue( self.fields['username'] ), QHelper.getValue( self.fields['passwd'] ) ) )
		
		self.quit = QtGui.QPushButton( 'Cancel', self )
		self.quit.clicked.connect( lambda: QHelper.master().emit( QtCore.SIGNAL( 'loginCancel' ) ) )
		
		self.preferences = QtGui.QPushButton( 'Preferences', self )
		self.submit.clicked.connect( lambda: QHelper.master().emit( QtCore.SIGNAL( 'loginSubmit' ), QHelper.getValue( self.fields['username'] ), QHelper.getValue( self.fields['passwd'] ) ) )
		QHelper.master().connect( self.preferences, QtCore.SIGNAL( 'clicked()' ), lambda:self.hide() or QHelper.master().Action.preferencesActionCallback() )
		
		hbox = QtGui.QHBoxLayout()
		hbox.addStretch( 1 )
		hbox.addWidget( self.preferences )
		hbox.addWidget( self.submit )
		hbox.addWidget( self.quit )
		
		buttons = QtGui.QWidget()
		buttons.setLayout( hbox )
		
		grid.addWidget( buttons, 4, 0, 1 ,2 )
		
		self.setLayout( grid )
		
		self.connect( QHelper.master(), QtCore.SIGNAL( 'loginSubmit' ), self.loginSubmitCallback )
		self.connect( QHelper.master(), QtCore.SIGNAL( 'loginSuccess' ), self.loginSuccessCallback )
		self.connect( QHelper.master(), QtCore.SIGNAL( 'loginError' ), self.loginErrorCallback )
		self.connect( QHelper.master(), QtCore.SIGNAL( 'loginCancel' ), self.loginCancelCallback )
		self.connect( QHelper.master(), QtCore.SIGNAL( 'preferencesSubmit' ), self.preferencesSubmitCallback )
		self.connect( QHelper.master(), QtCore.SIGNAL( 'preferencesCancel' ), self.preferencesCancelCallback )
Exemplo n.º 4
0
Arquivo: ui.py Projeto: hcit/pyqt
	def __init__( self ):
		QForm.__init__( self )
		self.setWindowTitle( 'Report' + ' - ' + DBConf.get( 'appname' ) )
		self.resize( 200, 200 )
		self.move( 350, 350 )
		
		grid = QtGui.QGridLayout()
		
		self.status = QtGui.QLabel( 'Report' )
		grid.addWidget( self.status, 0, 0, 2, 2 )
		
		grid.addWidget( QtGui.QLabel( 'Project' ), 2, 0 )
		grid.addWidget( self.comboBoxField( 'project' ), 2, 1 )
		
		grid.addWidget( self.lineEditField( 'h', '', 'hours' ), 3, 0 )
		grid.addWidget( self.lineEditField( 'm', '', 'minutes' ), 3, 1 )
		
		grid.addWidget( QtGui.QLabel( 'Summary' ), 4, 0, 1, 2 )
		grid.addWidget( self.textEditField( 'summary' ), 5, 0, 1, 2 )
		
		self.submit = QtGui.QPushButton( 'Send', self )
		self.submit.clicked.connect( lambda: QHelper.master().emit( QtCore.SIGNAL( 'reportSubmit' ) ) )
		grid.addWidget( self.submit, 6, 0 )
		
		self.cancel = QtGui.QPushButton( 'Cancel', self )
		self.cancel.clicked.connect( lambda: QHelper.master().emit( QtCore.SIGNAL( 'reportCancel' ) ) )
		grid.addWidget( self.cancel, 6, 1 )
		
		self.setLayout( grid )
		self.connect( QHelper.master(), QtCore.SIGNAL( 'projectList' ), self.projectListCallback )
		self.connect( QHelper.master(), QtCore.SIGNAL( 'reportSubmit' ), self.reportSubmitCallback )
		self.connect( QHelper.master(), QtCore.SIGNAL( 'reportCancel' ), self.reportCancelCallback )
Exemplo n.º 5
0
Arquivo: ui.py Projeto: hcit/pyqt
	def message( self, ts, sender, message ):
		text =  '<span style="color:#999;">[%s]</span> <span style="font-weight:bold; color:%s;">%s</span><br />%s<br />' % (
				datetime.datetime.fromtimestamp( int( str( ts ).split('.')[0] ) ).strftime( '%Y-%m-%d %H:%M:%S' ),
				( sender==DBConf.get( 'username' ) and '#000' or '#66f' ),
				sender,
				message.replace( '\n', '<br />' )
			)
		self.write( text )
Exemplo n.º 6
0
Arquivo: ui.py Projeto: hcit/pyqt
	def pickedContactCallback( self, contact ):
		QHelper.log( '::CONNECT:QChatDialog:pickedContact', contact )
		if not self.messagesTime.get( contact, None ): self.messagesTime[contact] = []
		if not self.messagesList.get( contact, None ): self.messagesList[contact] = {}
		self.parent.setWindowTitle( contact + ' - ' + DBConf.get( 'appname' ) )
		self.contact = contact
		self.clear()
		for message in self.messages( contact ):
			self.message( message['ts'], message['sender'], message['message'] )
Exemplo n.º 7
0
Arquivo: ui.py Projeto: hcit/pyqt
	def reportSubmitCallback( self ):
		QHelper.log( '::CONNECT:QReportView:reportSubmit' )
		data = self.values()
		reportData = 'report %sh %sm on %s %s' % (
			QHelper.str( data.get( 'h', '0' ) ),
			QHelper.str( data.get( 'm', '0' ) ),
			QHelper.str( data.get( 'project', '' ) ),
			QHelper.str( data.get( 'summary', '' ) ),
		)
		print '::REPORT:MESSAGE', reportData
		QHelper.master().emit( QtCore.SIGNAL( 'transportSignal' ), 'sendMessage', DBConf.get( 'bot' ), reportData )
		self.hide()
Exemplo n.º 8
0
Arquivo: ui.py Projeto: hcit/pyqt
	def __init__( self, parent=None ):
		if parent:
			super( self.__class__, self ).__init__( parent )
		else:
			super( self.__class__, self ).__init__()
		self.setWindowTitle( 'Projects' + ' - ' + DBConf.get( 'appname' ) )
		self.resize( 550, 450 )
		self.move( 350, 350 )
		
		grid = QtGui.QGridLayout()
		
		grid.addWidget( QProjectData( self ), 0, 0, 2, 1 )
		grid.addWidget( QtGui.QLineEdit( self ), 0, 1 )
		grid.addWidget( QProjectList( self ), 1, 1 )
		
		grid.setColumnMinimumWidth( 0, 300 )
		
		self.setLayout( grid )
Exemplo n.º 9
0
Arquivo: ui.py Projeto: hcit/pyqt
	def logoutActionCallback( self ):
		DBConf.set( 'username', '' )
		DBConf.set( 'passwd', '' )
		self.master.View.login().show()
		self.master.hide()
Exemplo n.º 10
0
Arquivo: ui.py Projeto: hcit/pyqt
	def preferencesSubmitCallback( self ):
		QHelper.log( '::CONNECT:QPreferencesView:preferencesSubmit' )
		for k, v in self.values().items():
			DBConf.set( k, type( DBConf.get( k ) )( v ) )
		self.hide()
Exemplo n.º 11
0
Arquivo: ui.py Projeto: hcit/pyqt
	def loginSuccessCallback( self ):
		QHelper.log( '::CONNECT:QLoginView:loginSuccess' )
		DBConf.set( 'username', QHelper.getValue( self.fields['username'] ) )
		DBConf.set( 'passwd', QHelper.getValue( self.fields['passwd'] ) )
		self.hide()
		self.status.setText( '' )
Exemplo n.º 12
0
Arquivo: ui.py Projeto: hcit/pyqt
	def loginSubmitCallback( self, username, passwd ):
		QHelper.log( '::CONNECT:QLoginView:loginSubmit', username, passwd )
		self.status.setStyleSheet( 'QLabel { color : gray; }' )
		self.status.setText( '...authentication' )
		QHelper.master().emit( QtCore.SIGNAL( 'transportSignal' ), '_connect', username, passwd, {'server':DBConf.get('server'),'port':DBConf.get('port'),'nickname':DBConf.get('username').split('.')[0].title()} )
Exemplo n.º 13
0
Arquivo: ui.py Projeto: hcit/pyqt
	def SIGNALCBloginSuccessCallback( self ):
		QHelper.log( '::CONNECT:master:loginSuccess' )
		self.master.show()
		self.master.View.contact().show()
		self.master.View.chat().hide()
		QHelper.master().emit( QtCore.SIGNAL( 'transportSignal' ), 'sendMessage', DBConf.get( 'bot' ), 'online' )