def handleClick(ev): key = ev['name'] taskResp = requests.get(myConfig['api'] + 'issue/' + key, auth=myAuth) task = taskResp.json() transitionsResp = requests.get(myConfig['api'] + 'issue/' + key + '/transitions', auth=myAuth) currentStatus = task['fields']['status'] transitions = [] for it in transitionsResp.json()['transitions']: if it['to']['id'] != currentStatus['id']: transitions += [it['id'], it['name']] summary = task['fields']['summary'] description = task['fields']['description'] reporter = task['fields']['reporter']['name'] if description == None: description = '' try: transitionId = zenity( '--list', '--title', key, '--text', '<b>' + summary + ':</b>\n' + description + '\n-<i>' + reporter + '</i>', '--column', 'ID', '--column', 'Transition', transitions ).strip() if transitionId: transit(key, transitionId) return True except ErrorReturnCode: pass
from os.path import splitext, abspath, basename, dirname, isfile from sh import zenity, notify_send new = "" message = "" i = 0 for f in argv[1:]: if "file://" in f: f = unquote(f)[7:] fdir = dirname(abspath(f)) name,ext = splitext(f) if new == "": new = zenity("--text", "Rename", "--entry", "--entry-text", basename(name)).strip() try: while True: i = i + 1 new_name = "%s/%s %s%s" % (fdir, new, i, ext) if not isfile(new_name): break rename(f, new_name) message = "%s%s → %s\n" % (message, f, new_name) except Exception as e: notify_send("Error", "-u", "critical", e) notify_send("Renamed", message)
from os.path import splitext, abspath, basename, dirname, isfile from sh import zenity, notify_send new = "" message = "" i = 0 for f in argv[1:]: if "file://" in f: f = unquote(f)[7:] fdir = dirname(abspath(f)) name, ext = splitext(f) if new == "": new = zenity("--text", "Rename", "--entry", "--entry-text", basename(name)).strip() try: while True: i = i + 1 new_name = "%s/%s %s%s" % (fdir, new, i, ext) if not isfile(new_name): break rename(f, new_name) message = "%s%s → %s\n" % (message, f, new_name) except Exception as e: notify_send("Error", "-u", "critical", e) notify_send("Renamed", message)
def show_progress_dialog(title, pulsate = False): progress = ProgressMonitor() zenity(progress = True, title = title, auto_close = True, pulsate = pulsate, _in = progress.get_queue(), _bg = True) # Give some time for window to appear return progress
def show_shared_url(url, failed_upload = []): failed_files_message = 'Some files were not uploaded:\n- {}'.format('\n- '.join(failed_upload)) if failed_upload else '' zenity(title = 'Shared URL', info = True, text = 'Your files are <a href="{}">now shared</a>.\n{}'.format(html.escape(url), failed_files_message), _ok_code = [0, 1])
def show_error(message): zenity(error = True, text = message)