text
stringlengths 1
93.6k
|
|---|
def mousePressEvent(self, event):
|
super().mousePressEvent(event)
|
if event.button() == Qt.LeftButton:
|
self.anchor = event.pos()
|
event.accept()
|
def mouseMoveEvent(self, event):
|
super().mouseMoveEvent(event)
|
if not (event.buttons() & Qt.LeftButton):
|
return
|
new_pos = event.pos() - self.anchor + self.frameGeometry().topLeft()
|
x, y = new_pos.x(), new_pos.y()
|
self.moveTo(x, y)
|
def mouseReleaseEvent(self, a0):
|
if SiGlobal.todo_list.position_locked is True:
|
self.moveTo(self.fixed_position.x(), self.fixed_position.y())
|
def closeEvent(self, a0):
|
super().closeEvent(a0)
|
# 获取当前待办,并写入 todos.ini
|
todos = [widget.text_label.text() for widget in self.todo_list_panel.body().widgets_top]
|
SiGlobal.todo_list.todos_parser.todos = todos
|
SiGlobal.todo_list.todos_parser.write()
|
# 写入设置到 options.ini
|
SiGlobal.todo_list.settings_parser.modify("FIXED_POSITION_X", self.fixed_position.x())
|
SiGlobal.todo_list.settings_parser.modify("FIXED_POSITION_Y", self.fixed_position.y())
|
SiGlobal.todo_list.settings_parser.write()
|
SiGlobal.siui.windows["TOOL_TIP"].close()
|
QCoreApplication.quit()
|
# <FILESEP>
|
#!/bin/python
|
import printf
|
import ovirtsdk4 as sdk
|
import ovirtsdk4.types as types
|
import time
|
import sys
|
import subprocess
|
import requests
|
import requests
|
import ConfigParser
|
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
requests.packages.urllib3.disable_warnings()
|
import xml.etree.ElementTree as ET
|
import thread
|
import virtbkp_utils
|
# Get default values
|
cfg = ConfigParser.ConfigParser()
|
cfg.readfp(open(sys.argv[1]))
|
url=cfg.get('bkp', 'url')
|
user=cfg.get('bkp', 'user')
|
password=cfg.get('bkp', 'password')
|
ca_file=cfg.get('bkp', 'ca_file')
|
bckdir=cfg.get('bkp', 'bckdir')
|
bkpvm=cfg.get('bkp', 'bkpvm')
|
vmname=sys.argv[2]
|
date=str((time.strftime("%Y-%m-%d-%H")))
|
vmid=""
|
snapname = "BACKUP" + "_" + date +"h"
|
try:
|
# Create a connection to the server:
|
connection = sdk.Connection(
|
url=url,
|
username=user,
|
password=password,
|
ca_file=ca_file)
|
printf.OK("Connection to oVIrt API success %s" % url)
|
except Exception as ex:
|
printf.ERROR("Connection to oVirt API has failed")
|
#print "Unexpected error: %s" % ex
|
# Funcion para obtener el id de la vm buscandola por el nombre
|
# Function to get VM_ID from VM name
|
def get_id_vm(vmname):
|
vm_service = connection.service("vms")
|
vms = vm_service.list()
|
for vm in vms:
|
if vm.name == vmname:
|
return vm.id
|
# Funcion para obtener el ID del snapshot creado
|
# Function to get ID of created snapshot
|
def get_snap_id(idvm):
|
headers = {'Content-Type': 'application/xml', 'Accept': 'application/xml'}
|
vmsnap_service = connection.service("vms/"+idvm+"/snapshots")
|
snaps = vmsnap_service.list()
|
for snap in snaps:
|
if snap.description == snapname:
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.