本文整理汇总了Python中settings._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent=None):
QMainWindow.__init__(self, parent)
self.mimes = {'team': 'application/x-team-item',
'event': 'application/x-calendar-event',
}
self.rooms = []
self.tree = []
self.rfid_id = None
self.http = Http(self)
self.work_hours = (8, 24)
self.schedule_quant = timedelta(minutes=30)
self.menus = []
self.create_menus()
self.setup_views()
settings = QSettings()
settings.beginGroup('network')
host = settings.value('addressHttpServer', QVariant('WrongHost'))
settings.endGroup()
if 'WrongHost' == host.toString():
self.setupApp()
self.baseTitle = _('Manager\'s interface')
self.logoutTitle()
self.statusBar().showMessage(_('Ready'), 2000)
self.resize(640, 480)
开发者ID:mabragor,项目名称:foobar,代码行数:31,代码来源:manager.py
示例2: __init__
def __init__(self, parent=None):
QDialog.__init__(self, parent)
self.parent = parent
self.setMinimumWidth(600)
self.count = QLineEdit()
self.price = QLineEdit()
layoutGrid = QGridLayout()
layoutGrid.setColumnStretch(1, 1)
layoutGrid.setColumnMinimumWidth(1, 250)
layoutGrid.addWidget(QLabel(_("Count")), 0, 0)
layoutGrid.addWidget(self.count, 0, 1)
layoutGrid.addWidget(QLabel(_("Price")), 1, 0)
layoutGrid.addWidget(self.price, 1, 1)
buttonApplyDialog = QPushButton(_("Apply"))
buttonCancelDialog = QPushButton(_("Cancel"))
self.connect(buttonApplyDialog, SIGNAL("clicked()"), self.applyDialog)
self.connect(buttonCancelDialog, SIGNAL("clicked()"), self, SLOT("reject()"))
buttonLayout = QHBoxLayout()
buttonLayout.addStretch(1)
buttonLayout.addWidget(buttonApplyDialog)
buttonLayout.addWidget(buttonCancelDialog)
layout = QVBoxLayout()
layout.addLayout(layoutGrid)
layout.addLayout(buttonLayout)
self.setLayout(layout)
self.setWindowTitle(_("Add resource"))
开发者ID:mabragor,项目名称:foobar,代码行数:35,代码来源:dlg_accounting.py
示例3: __init__
def __init__(self, parent=None):
QDialog.__init__(self, parent)
self.parent = parent
self.tabWidget = QTabWidget()
self.tabWidget.addTab(TabGeneral(self), _('General'))
self.tabWidget.addTab(TabNetwork(self), _('Network'))
self.tabIndex = ['general', 'network']
applyButton = QPushButton(_('Apply'))
cancelButton = QPushButton(_('Cancel'))
self.connect(applyButton, SIGNAL('clicked()'),
self.applyDialog)
self.connect(cancelButton, SIGNAL('clicked()'),
self, SLOT('reject()'))
buttonLayout = QHBoxLayout()
buttonLayout.addStretch(1)
buttonLayout.addWidget(applyButton)
buttonLayout.addWidget(cancelButton)
mainLayout = QVBoxLayout()
mainLayout.addWidget(self.tabWidget)
mainLayout.addLayout(buttonLayout)
self.setLayout(mainLayout)
self.setWindowTitle(_('Settings'))
# load settings
self.settings = QSettings()
self.loadSettings()
开发者ID:mabragor,项目名称:foobar,代码行数:34,代码来源:dlg_settings.py
示例4: get_static
def get_static(self):
"""
Gets static information from server.
First, all present rooms are L{retrieved<Http.request>}. They are
returned as a dict in the following format::
{'rows': [{'color': 'FFAAAA', 'text': 'red', 'id': 1},
{'color': 'AAFFAA', 'text': 'green', 'id': 2},
...]}
Then, other static info is retrieved???
"""
# get rooms
if not self.http.request('/manager/get_rooms/', {}):
QMessageBox.critical(self, _('Room info'), _('Unable to fetch: %s') % self.http.error_msg)
return
default_response = {'rows': []}
response = self.http.parse(default_response)
self.rooms = tuple( [ (a['title'], a['color'], a['id']) for a in response['rows'] ] )
self.schedule.update_static( {'rooms': self.rooms} )
# static info
if not self.http.request('/manager/static/', {}):
QMessageBox.critical(self, _('Static info'), _('Unable to fetch: %s') % self.http.error_msg)
return
response = self.http.parse()
self.static = response
print 'Static is', self.static.keys()
开发者ID:mabragor,项目名称:foobar,代码行数:29,代码来源:manager.py
示例5: reset
def reset(self):
request = self.request
registry = request.registry
data, errors = self.extract()
login = data.get('login')
if login:
principal = authService.get_principal_bylogin(login)
if principal is not None and \
passwordTool.can_change_password(principal):
passcode = passwordTool.generate_passcode(principal)
template = ResetPasswordTemplate(principal, request)
template.passcode = passcode
template.send()
self.request.registry.notify(
ResetPasswordInitiatedEvent(principal))
self.message(_('Password reseting process has been initiated. '
'Check your email for futher instructions.'))
raise HTTPFound(location=request.application_url)
self.message(_(u"System can't restore password for this user."))
开发者ID:blaflamme,项目名称:ptah,代码行数:26,代码来源:resetpassword.py
示例6: __init__
def __init__(self, parent=None):
QDialog.__init__(self, parent)
self.parent = parent
self.setMinimumWidth(400)
self.calendar = QCalendarWidget()
self.calendar.setFirstDayOfWeek(Qt.Monday)
self.calendar.setGridVisible(True)
self.calendar.setMinimumDate(QDate.currentDate())
self.calendar.showToday()
buttonApplyDialog = QPushButton(_('Apply'))
buttonCancelDialog = QPushButton(_('Cancel'))
self.connect(buttonApplyDialog, SIGNAL('clicked()'),
self.applyDialog)
self.connect(buttonCancelDialog, SIGNAL('clicked()'),
self, SLOT('reject()'))
buttonLayout = QHBoxLayout()
buttonLayout.addStretch(1)
buttonLayout.addWidget(buttonApplyDialog)
buttonLayout.addWidget(buttonCancelDialog)
layout = QVBoxLayout()
layout.addWidget(self.calendar)
layout.addLayout(buttonLayout)
self.setLayout(layout)
self.setWindowTitle(_('Choose a week to fill'))
开发者ID:mabragor,项目名称:foobar,代码行数:31,代码来源:dlg_copy_week.py
示例7: assignRFID
def assignRFID(self):
def callback(rfid):
self.rfid_id = rfid
params = {
'http': self.http,
'static': self.static,
'mode': 'client',
'callback': callback,
}
dialog = WaitingRFID(self, params)
dialog.setModal(True)
dlgStatus = dialog.exec_()
if QDialog.Accepted == dlgStatus:
# check the rfid code
params = {'rfid_code': self.rfid_id, 'mode': 'client'}
if not self.http.request('/manager/get_client_info/', params):
QMessageBox.critical(self, _('Client info'), _('Unable to fetch: %s') % self.http.error_msg)
return
default_response = None
response = self.http.parse(default_response)
if response and 'info' in response and response['info'] is not None:
QMessageBox.warning(self, _('Warning'),
_('This RFID is used already!'))
else:
self.buttonRFID.setText(self.rfid_id)
self.buttonRFID.setDisabled(True)
开发者ID:mabragor,项目名称:foobar,代码行数:28,代码来源:user_info.py
示例8: context_menu
def context_menu(self, position):
""" Create context menu."""
menu = QMenu()
index = self.tableHistory.indexAt(position)
model = index.model()
# payment
action_payment_add = menu.addAction(_('Payment'))
need_to_add = self.payment_diff(index)
if need_to_add < 0.01:
action_payment_add.setDisabled(True)
# cancel
action_cancel = menu.addAction(_('Cancel'))
idx_cancel = model.index(index.row(), self.COLUMN_CANCEL_INDEX)
card_cancel = model.data(idx_cancel, Qt.DisplayRole)
if type(card_cancel) is unicode:
action_cancel.setDisabled(True)
# show context menu
action = menu.exec_(self.tableHistory.mapToGlobal(position))
# choose action
if action == action_payment_add:
self.payment_add(index, need_to_add)
elif action == action_cancel:
QMessageBox.warning(self, _('Warning'),
_('Not yet implemented!'))
else:
print 'unknown'
开发者ID:mabragor,项目名称:foobar,代码行数:31,代码来源:user_info.py
示例9: __init__
def __init__(self, parent, params=dict()):
self.mode = params.get('mode', 'client')
self.apply_title = params.get('apply_title', _('Show'))
if self.mode == 'client':
self.title = _('Search client')
else:
self.title = _('Search renter')
UiDlgTemplate.__init__(self, parent, params)
开发者ID:mabragor,项目名称:foobar,代码行数:8,代码来源:searching.py
示例10: _convertor
def _convertor(listitem):
if type(listitem) is not dict:
raise ValueError(_('It expexts a dictionary but took %s') % type(key_field))
if key_field not in listitem:
raise KeyError(_('Key "%s" does not exists. Check dictionary.') % key_field)
result.update( {listitem[key_field]: listitem} )
return True
开发者ID:mabragor,项目名称:foobar,代码行数:8,代码来源:library.py
示例11: applyDialog
def applyDialog(self):
""" Apply settings. """
userinfo, ok = self.checkFields()
if ok:
if self.saveSettings(userinfo):
self.accept()
else:
QMessageBox.warning(self, _('Warning'),
_('Please fill all fields.'))
开发者ID:mabragor,项目名称:foobar,代码行数:9,代码来源:user_info.py
示例12: _search
def _search(listitem):
if type(listitem) is not dict:
raise ValueError(_('It expexts a dictionary but took %s') % type(key_field))
if key_field not in listitem:
raise KeyError(_('Key "%s" does not exists. Check dictionary.') % key_field)
if type(value) in (list, tuple):
return listitem[key_field] in value
else:
return listitem[key_field] == value
开发者ID:mabragor,项目名称:foobar,代码行数:9,代码来源:library.py
示例13: applyDialog
def applyDialog(self):
try:
count = int(self.count.text())
price = float(self.price.text())
except:
QMessageBox.warning(self, _("Warning"), _("Improper values."))
return
self.callback(count, price)
self.accept()
开发者ID:mabragor,项目名称:foobar,代码行数:9,代码来源:dlg_accounting.py
示例14: exchangeRooms
def exchangeRooms(self):
exchanged = self.model().exchangeRoom(self.current_data,
self.selected_data)
if exchanged:
data = self.current_data
self.current_data = self.selected_data
self.selected_data = data
self.parent.statusBar().showMessage(_('Complete.'))
else:
self.parent.statusBar().showMessage(_('Unable to exchange.'))
开发者ID:mabragor,项目名称:foobar,代码行数:10,代码来源:qtschedule.py
示例15: login
def login(self):
'''
Shows log in dialog, where manager is asked to provide login/password
pair.
If 'Ok' button is clicked, authentication L{request<Http.request>} is
made to the server, which is then L{parsed<Http.parse>}.
On success:
- information about schedule is retrieved from the server and
and L{QtSchedule} widget is L{updated<update_interface>}.
- controls are L{activated<interface_disable>}.
- window title is L{updated<loggedTitle>}
- schedule information is being L{refreshed<refresh_data>} from now on.
In case of failure to authenticate a message is displayed.
'''
def callback(credentials):
self.credentials = credentials
self.dialog = DlgLogin(self)
self.dialog.setCallback(callback)
self.dialog.setModal(True)
dlgStatus = self.dialog.exec_()
if QDialog.Accepted == dlgStatus:
if not self.http.request('/manager/login/', self.credentials):
QMessageBox.critical(self, _('Login'), _('Unable to login: %s') % self.http.error_msg)
return
default_response = None
response = self.http.parse(default_response)
if response and 'user_info' in response:
self.loggedTitle(response['user_info'])
# update application's interface
self.get_static()
self.get_dynamic()
self.update_interface()
self.schedule.model().showCurrWeek()
# run refresh timer
self.refreshTimer = QTimer(self)
from settings import SCHEDULE_REFRESH_TIMEOUT
self.refreshTimer.setInterval(SCHEDULE_REFRESH_TIMEOUT)
self.connect(self.refreshTimer, SIGNAL('timeout()'), self.refresh_data)
self.refreshTimer.start()
self.interface_disable(False)
else:
QMessageBox.warning(self, _('Login failed'),
_('It seems you\'ve entered wrong login/password.'))
开发者ID:mabragor,项目名称:foobar,代码行数:54,代码来源:manager.py
示例16: client_search_rfid
def client_search_rfid(self):
'''
Search client in the database
by RFID (Radio Frequency IDentificator).
After RFID was successfully read from card, server is
L{requested<Http.request>} client info.
If user is found in database, L{dialog<ClientInfo>}
with information about client is displayed.
Otherwise, messageboxes with warnings are displayed.
'''
if not self.http or not self.http.is_session_open():
return # login first
def callback(rfid):
self.rfid_id = rfid
params = {
'http': self.http,
'static': self.static,
'mode': 'client',
'callback': callback,
}
dialog = WaitingRFID(self, params)
dialog.setModal(True)
dlgStatus = dialog.exec_()
if QDialog.Accepted == dlgStatus and self.rfid_id is not None:
params = {'rfid_code': self.rfid_id, 'mode': 'client'}
if not self.http.request('/manager/get_client_info/', params):
QMessageBox.critical(self, _('Client info'), _('Unable to fetch: %s') % self.http.error_msg)
return
default_response = None
response = self.http.parse(default_response)
if not response or response['info'] is None:
QMessageBox.warning(self, _('Warning'),
_('This RFID belongs to nobody.'))
else:
user_info = response['info']
params = {
'http': self.http,
'static': self.static,
}
self.dialog = ClientInfo(self, params)
self.dialog.setModal(True)
self.dialog.initData(user_info)
self.dialog.exec_()
self.rfid_id = None
开发者ID:mabragor,项目名称:foobar,代码行数:53,代码来源:manager.py
示例17: searchFor
def searchFor(self):
name = self.editSearch.text().toUtf8()
params = {'name': name, 'mode': self.mode}
if not self.http.request('/manager/get_users_info_by_name/', params):
QMessageBox.critical(self, _('Searching'), _('Unable to search: %s') % self.http.error_msg)
return
default_response = None
response = self.http.parse(default_response)
if response and 'users' in response:
user_list = response['users']
self.showList(user_list)
self.buttonApply.setDisabled(False)
开发者ID:mabragor,项目名称:foobar,代码行数:12,代码来源:searching.py
示例18: send_success_mail
def send_success_mail(self, raw_password):
''' send success emails '''
# prepare context
context = {
'node': self,
'password': raw_password,
'site': SITE
}
# send email to owners
email_owners(self, _('Node confirmed successfully on %(site)s') % {'site':SITE['name']}, 'email_notifications/success.txt', context)
# notify admins that want to receive notifications
notify_admins(self, _('New node details on %(site)s') % {'site':SITE['name']}, 'email_notifications/new-node-admin.txt', context, skip=True)
开发者ID:fsquillace,项目名称:nodeshot,代码行数:12,代码来源:models.py
示例19: __init__
def __init__(self, parent=None):
QTableView.__init__(self, parent)
self.verticalHeader().setResizeMode(QHeaderView.Fixed)
self.horizontalHeader().setResizeMode(QHeaderView.ResizeToContents)
self.actionRentCancel = QAction(_('Cancel rent'), self)
self.actionRentCancel.setStatusTip(_('Cancel current rent.'))
self.connect(self.actionRentCancel, SIGNAL('triggered()'), self.rentCancel)
self.delegate = RentListDelegate()
self.setItemDelegate(self.delegate)
开发者ID:mabragor,项目名称:foobar,代码行数:12,代码来源:rent_list.py
示例20: checkFields
def checkFields(self):
userinfo = {
'last_name': self.editLastName.text().toUtf8(),
'first_name': self.editFirstName.text().toUtf8(),
'email': self.editEmail.text().toUtf8(),
'phone_mobile': self.editPhoneMobile.text().toUtf8(),
'phone_work': self.editPhoneWork.text().toUtf8(),
'phone_home': self.editPhoneHome.text().toUtf8(),
}
errorHighlight = []
phones = 0
for title, widget in [(_('Last name'), self.editLastName),
(_('First name'), self.editFirstName),
(_('E-mail'), self.editEmail)]:
if 0 == len(widget.text().toUtf8()):
errorHighlight.append(title)
for title, widget in [(_('Mobile phone'), self.editPhoneMobile),
(_('Work phone'), self.editPhoneWork),
(_('Home phone'), self.editPhoneHome)]:
if 0 < len(widget.text().toUtf8()):
phones += 1
if phones == 0:
errorHighlight.append(_('Phones'))
if len(errorHighlight) > 0:
QMessageBox.critical(
self.parent, _('Dialog error'),
'Fields %s must be filled.' % ', '.join(errorHighlight))
return (userinfo, False)
return (userinfo, True)
开发者ID:mabragor,项目名称:foobar,代码行数:30,代码来源:user_info.py
注:本文中的settings._函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论