本文整理汇总了Python中src.gui.main_window.Pireal类的典型用法代码示例。如果您正苦于以下问题:Python Pireal类的具体用法?Python Pireal怎么用?Python Pireal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Pireal类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __on_copy_available
def __on_copy_available(self, value):
""" Change states of cut and copy action """
cut_action = Pireal.get_action("cut_action")
cut_action.setEnabled(value)
copy_action = Pireal.get_action("copy_action")
copy_action.setEnabled(value)
开发者ID:yoshitomimaehara,项目名称:pireal,代码行数:7,代码来源:query_container.py
示例2: __init__
def __init__(self):
super(StatusBar, self).__init__()
Pireal.load_service("status", self)
self.connect(self, SIGNAL("messageChanged(QString)"),
self.__message_end)
开发者ID:papablopo07,项目名称:pireal,代码行数:7,代码来源:status_bar.py
示例3: execute_queries
def execute_queries(self, query=''):
""" This function executes queries """
# Hide tooltip if visible
if QToolTip.isVisible():
QToolTip.hideText()
# If text is selected, then this text is the query,
# otherwise the query is all text that has the editor
editor_widget = self.currentWidget().get_editor()
if editor_widget.textCursor().hasSelection():
query = editor_widget.textCursor().selectedText()
else:
query = editor_widget.toPlainText()
relations = self.currentWidget().relations
central = Pireal.get_service("central")
table_widget = central.get_active_db().table_widget
# Restore
relations.clear()
self.currentWidget().clear_results()
# Parse query
sc = scanner.Scanner(query)
lex = lexer.Lexer(sc)
try:
par = parser.Parser(lex)
interpreter = parser.Interpreter(par)
interpreter.clear()
interpreter.to_python()
except Exception as reason:
pireal = Pireal.get_service("pireal")
pireal.show_error_message(self.parse_error(reason.__str__()))
return
relations.update(table_widget.relations)
for relation_name, expression in list(interpreter.SCOPE.items()):
if relation_name in relations:
QMessageBox.critical(self,
self.tr("Query Error"),
self.tr("<b>{}</b> is a duplicate "
"relation name.<br><br> "
"Please choose a unique name "
"and re-execute the "
"queries.".format(
relation_name)))
del interpreter.SCOPE[relation_name]
return
try:
new_relation = eval(expression, {}, relations)
except Exception as reason:
pireal = Pireal.get_service("pireal")
pireal.show_error_message(self.parse_error(reason.__str__()),
syntax_error=False)
return
relations[relation_name] = new_relation
self.__add_table(new_relation, relation_name)
开发者ID:centaurialpha,项目名称:pireal,代码行数:59,代码来源:query_container.py
示例4: execute_queries
def execute_queries(self):
# Editor instance
query_editor = Pireal.get_service("query-editor").editor
query = query_editor.toPlainText() # Text
# Parse query
expression = parser.convert_to_python(query)
table_widget = Pireal.get_service("db")
rel = eval(expression, table_widget.relations)
开发者ID:intermezzo-fr,项目名称:pireal,代码行数:8,代码来源:actions.py
示例5: new_query
def new_query(self, filename=''):
query_widget = Pireal.get_service("query_widget")
self.addWidget(query_widget)
if not query_widget.isVisible():
query_widget.show()
pireal = Pireal.get_service("pireal")
pireal.enable_disable_query_actions()
query_widget.new_query(filename)
self.connect(query_widget,
SIGNAL("currentEditorSaved(QPlainTextEdit)"),
self.save_query)
开发者ID:papablopo07,项目名称:pireal,代码行数:12,代码来源:container.py
示例6: add_table
def add_table(self, rela, rname):
central_widget = Pireal.get_service("central")
lateral_widget = Pireal.get_service("lateral_widget")
db = central_widget.get_active_db()
_view = db.create_table(rela, rname, editable=False)
table_widget = central_widget.get_active_db().table_widget
index = table_widget.stacked_result.addWidget(_view)
table_widget.stacked_result.setCurrentIndex(index)
lateral_widget.result_list.add_item(
rname, rela.cardinality(), rela.degree())
# lateral_widget.result_list.select_last()
table_widget._tabs.setCurrentIndex(1)
开发者ID:yoshitomimaehara,项目名称:pireal,代码行数:12,代码来源:query_container.py
示例7: new_query
def new_query(self):
from src.gui.query_editor import query_widget
widget = query_widget.QueryWidget()
pireal = Pireal.get_service("pireal")
# Load the instance
Pireal.load_service("query-editor", widget)
# MdiArea
mdi = Pireal.get_service("mdi")
widget.setMinimumSize(mdi.width(), mdi.minimumSizeHint().height())
mdi.addSubWindow(widget)
# Enable querie's QAction
pireal.enable_disable_query_actions()
widget.show()
开发者ID:intermezzo-fr,项目名称:pireal,代码行数:13,代码来源:actions.py
示例8: __init__
def __init__(self, parent=None):
super(Notification, self).__init__(parent)
box = QVBoxLayout(self)
box.setContentsMargins(50, 0, 0, 0)
self.notificator = QLabel("")
box.addWidget(self.notificator)
# Timer
self.timer = QTimer(self)
self.timer.timeout.connect(self.clear)
# Install service
Pireal.load_service("notification", self)
开发者ID:yoshitomimaehara,项目名称:pireal,代码行数:13,代码来源:notification.py
示例9: __init__
def __init__(self):
super(LateralWidget, self).__init__()
self._list_widget = QListWidget()
self.setWidget(self._list_widget)
Pireal.load_service("lateral", self)
self._list_widget.setContextMenuPolicy(Qt.CustomContextMenu)
self.connect(self._list_widget, SIGNAL("currentRowChanged(int)"),
self._change_item)
self.connect(self._list_widget,
SIGNAL("customContextMenuRequested(const QPoint)"),
self.__show_context_menu)
开发者ID:intermezzo-fr,项目名称:pireal,代码行数:14,代码来源:lateral_widget.py
示例10: __init__
def __init__(self, orientation=Qt.Vertical):
super(Container, self).__init__(orientation)
self._data_bases = []
self.__filename = ""
vbox = QVBoxLayout(self)
vbox.setContentsMargins(0, 0, 0, 0)
self.__created = False
# Stacked
self.stacked = QStackedWidget()
vbox.addWidget(self.stacked)
# Table
self.table_widget = table_widget.TableWidget()
Pireal.load_service("container", self)
开发者ID:intermezzo-fr,项目名称:pireal,代码行数:15,代码来源:container.py
示例11: create_data_base
def create_data_base(self):
mdi = Pireal.get_service("mdi")
db_name, ok = QInputDialog.getText(mdi, self.tr("New DB"),
self.tr("Name:"),
text=getpass.getuser())
if ok:
from src.gui import table_widget
db_widget = table_widget.MdiDB()
db_widget.setWindowTitle(db_name + '.pdb')
db_widget.setMinimumSize(mdi.width(), mdi.height() / 1.7)
mdi.addSubWindow(db_widget)
# Enable QAction's
pireal = Pireal.get_service("pireal")
pireal.enable_disable_db_actions()
db_widget.show()
开发者ID:intermezzo-fr,项目名称:pireal,代码行数:15,代码来源:actions.py
示例12: clear_results
def clear_results(self):
central_widget = Pireal.get_service("central")
lateral_widget = Pireal.get_service("lateral_widget")
lateral_widget.result_list.clear_items()
table_widget = central_widget.get_active_db().table_widget
i = table_widget.stacked_result.count()
# i = self._stack_tables.count()
while i >= 0:
# widget = self._stack_tables.widget(i)
widget = table_widget.stacked_result.widget(i)
# self._stack_tables.removeWidget(widget)
table_widget.stacked_result.removeWidget(widget)
if widget is not None:
widget.deleteLater()
i -= 1
开发者ID:yoshitomimaehara,项目名称:pireal,代码行数:15,代码来源:query_container.py
示例13: add_new_table
def add_new_table(self, rel, name):
import itertools
table = QTableWidget()
table.setRowCount(0)
table.setColumnCount(0)
data = itertools.chain([rel.fields], rel.content)
for row_data in data:
row = table.rowCount()
table.setColumnCount(len(row_data))
for col, text in enumerate(row_data):
item = QTableWidgetItem()
item.setText(text)
if row == 0:
table.setHorizontalHeaderItem(col, item)
else:
table.setItem(row - 1, col, item)
table.insertRow(row)
table.removeRow(table.rowCount() - 1)
self.stacked.addWidget(table)
self.stacked.setCurrentIndex(self.stacked.count() - 1)
lateral = Pireal.get_service("lateral")
lateral.add_item_list([name])
开发者ID:intermezzo-fr,项目名称:pireal,代码行数:25,代码来源:table_widget.py
示例14: add_data_base
def add_data_base(self, data):
lateral = Pireal.get_service("lateral")
rel = None
for part in data.split('@'):
for e, line in enumerate(part.splitlines()):
if e == 0:
name = line.split(':')[0]
rel = relation.Relation()
rel.fields = line.split(':')[-1].split(',')
else:
rel.insert(line.split(','))
if rel is not None:
table = Table()
table.setRowCount(1)
table.setColumnCount(0)
self.relations[name] = rel
for _tuple in rel.content:
row = table.rowCount()
table.setColumnCount(len(rel.fields))
for column, text in enumerate(_tuple):
item = Item()
item.setText(text)
table.setItem(row - 1, column, item)
table.insertRow(row)
table.setHorizontalHeaderLabels(rel.fields)
self.stacked.addWidget(table)
table.removeRow(table.rowCount() - 1)
lateral.add_item_list([name])
开发者ID:papablopo07,项目名称:pireal,代码行数:29,代码来源:table_widget.py
示例15: _check_count
def _check_count(self):
""" Hide dock if count = 0 """
if self.tab.count() == 0:
pireal = Pireal.get_service("pireal")
pireal.enable_disable_query_actions(False)
self.hide()
开发者ID:papablopo07,项目名称:pireal,代码行数:7,代码来源:query_widget.py
示例16: __init__
def __init__(self):
QWidget.__init__(self)
box = QVBoxLayout(self)
box.setContentsMargins(0, 0, 0, 0)
box.setSpacing(0)
self.stacked = QStackedWidget()
box.addWidget(self.stacked)
self.created = False
self.__last_open_folder = None
self.__recent_dbs = []
if PSetting.RECENT_DBS:
self.__recent_dbs = PSetting.RECENT_DBS
Pireal.load_service("central", self)
开发者ID:centaurialpha,项目名称:pireal,代码行数:16,代码来源:central_widget.py
示例17: __on_wizard_finished
def __on_wizard_finished(self, data, wizard_widget):
""" This slot execute when wizard to create a database is finished """
pireal = Pireal.get_service("pireal")
if not data:
# If it's canceled, remove wizard widget and return to Start Page
self.remove_last_widget()
else:
# Create a new data base container
db_container = database_container.DatabaseContainer()
# Associate the file name with the PFile object
pfile_object = pfile.File(data['filename'])
# Associate PFile object with data base container
# and add widget to stacked
db_container.pfile = pfile_object
self.add_widget(db_container)
# Remove wizard
self.stacked.removeWidget(wizard_widget)
# Set window title
pireal.change_title(file_manager.get_basename(data['filename']))
# Enable db actions
pireal.set_enabled_db_actions(True)
pireal.set_enabled_relation_actions(True)
self.created = True
DEBUG("Base de datos creada correctamente: '{}'".format(
data['filename']))
# If data or not, show menubar and toolbar again
pireal.show_hide_menubar()
pireal.show_hide_toolbar()
开发者ID:centaurialpha,项目名称:pireal,代码行数:30,代码来源:central_widget.py
示例18: __hide
def __hide(self):
if self.count() == 0:
self.hide()
# Disable query actions
pireal = Pireal.get_service("pireal")
pireal.set_enabled_query_actions(False)
pireal.set_enabled_editor_actions(False)
开发者ID:yoshitomimaehara,项目名称:pireal,代码行数:7,代码来源:query_container.py
示例19: execute_queries
def execute_queries(self):
import re
# Editor instance
editor = self.tab.currentWidget()
# Text
text = editor.toPlainText()
# Ignore comments
table = Pireal.get_service("container").table_widget
for line in text.splitlines():
if line.startswith('--'):
continue
parts = line.split('=', 1)
parts[0] = parts[0].strip()
if re.match(r'^[_a-zA-Z]+[_a-zA-Z0-9]*$', parts[0]):
relation_name, line = parts
else:
relation_name = 'rel_{}'.format(self.__nrelation)
self.__nrelation += 1
try:
expression = parser.convert_to_python(line.strip())
rel = eval(expression, table.relations)
except Exception as reason:
#try:
#except Exception as reason:
QMessageBox.critical(self, self.tr("Error en consulta"),
reason.__str__())
return
table.add_new_table(rel, relation_name)
table.relations[relation_name] = rel
开发者ID:papablopo07,项目名称:pireal,代码行数:30,代码来源:query_widget.py
示例20: __init__
def __init__(self, orientation=Qt.Vertical):
super(Container, self).__init__(orientation)
self.__last_open_folder = None
self.__filename = ""
self.__created = False
self.__modified = False
vbox = QVBoxLayout(self)
vbox.setContentsMargins(0, 0, 0, 0)
# Stacked
self.stacked = QStackedWidget()
vbox.addWidget(self.stacked)
# Table
self.table_widget = table_widget.TableWidget()
Pireal.load_service("container", self)
开发者ID:papablopo07,项目名称:pireal,代码行数:16,代码来源:container.py
注:本文中的src.gui.main_window.Pireal类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论