本文整理汇总了Python中stalker.db.session.DBSession.delete方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.delete方法的具体用法?Python DBSession.delete怎么用?Python DBSession.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stalker.db.session.DBSession
的用法示例。
在下文中一共展示了DBSession.delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: reject
# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import delete [as 别名]
def reject(self):
QtWidgets.QDialog.reject(self)
from stalker.db.session import DBSession
if self.version:
DBSession.delete(self.version)
DBSession.commit()
DBSession.rollback()
示例2: show_context_menu
# 需要导入模块: from stalker.db.session import DBSession [as 别名]
# 或者: from stalker.db.session.DBSession import delete [as 别名]
def show_context_menu(self, position):
"""the custom context menu
"""
# convert the position to global screen position
global_position = self.mapToGlobal(position)
index = self.indexAt(position)
model = self.model()
item = model.itemFromIndex(index)
logger.debug('itemAt(position) : %s' % item)
task_id = None
entity = None
# if not item:
# return
# if item and not hasattr(item, 'task'):
# return
from anima.ui.models.task import TaskItem
#if not isinstance(item, TaskItem):
# return
if item and item.task:
task_id = item.task.id
# if not task_id:
# return
from anima import utils
file_browser_name = utils.file_browser_name()
# create the menu
menu = QtWidgets.QMenu() # Open in browser
# sub menus
create_sub_menu = menu.addMenu('Create')
update_sub_menu = menu.addMenu('Update')
# -----------------------------------
# actions created in different scopes
create_time_log_action = None
create_project_action = None
update_task_action = None
create_child_task_action = None
duplicate_task_hierarchy_action = None
delete_task_action = None
no_deps_action = None
create_project_structure_action = None
create_task_structure_action = None
update_project_action = None
assign_users_action = None
open_in_web_browser_action = None
open_in_file_browser_action = None
copy_url_action = None
copy_id_to_clipboard = None
fix_task_status_action = None
change_status_menu_actions = []
from anima import defaults
from stalker import LocalSession
local_session = LocalSession()
logged_in_user = local_session.logged_in_user
from stalker import SimpleEntity, Task, Project
# TODO: Update this to use only task_id
if task_id:
entity = SimpleEntity.query.get(task_id)
if defaults.is_power_user(logged_in_user):
# create the Create Project menu item
create_project_action = \
create_sub_menu.addAction(u'\uf0e8 Create Project...')
if isinstance(entity, Project):
# this is a project!
if defaults.is_power_user(logged_in_user):
update_project_action = \
update_sub_menu.addAction(u'\uf044 Update Project...')
assign_users_action = \
menu.addAction(u'\uf0c0 Assign Users...')
create_project_structure_action = \
create_sub_menu.addAction(
u'\uf115 Create Project Structure'
)
create_child_task_action = \
create_sub_menu.addAction(
u'\uf0ae Create Child Task...'
)
if entity:
# separate the Project and Task related menu items
menu.addSeparator()
open_in_web_browser_action = \
menu.addAction(u'\uf14c Open In Web Browser...')
open_in_file_browser_action = \
menu.addAction(u'\uf07c Browse Folders...')
copy_url_action = menu.addAction(u'\uf0c5 Copy URL')
copy_id_to_clipboard = \
#.........这里部分代码省略.........