Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions YubiGuard/YubiGuard.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# YubiGuard VERSION 0.9.3
# LICENSE: GNU General Public License v3.0
Expand All @@ -12,8 +12,7 @@
import subprocess
import sys
import time
from multiprocessing import Process
from multiprocessing.queues import Queue
from multiprocessing import Process, Queue
from threading import Thread

import gi.repository
Expand Down Expand Up @@ -57,7 +56,7 @@ def shell_this(cmd):
cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
stdout = []
while True:
line = p.stdout.readline()
line = p.stdout.readline().decode()
stdout.append(line)
# print line,
if line == '' and p.poll() is not None:
Expand All @@ -76,7 +75,7 @@ def get_scrlck_cmd():
xfce='xflock4')
sh_out = shell_this("ls /usr/bin/*session")

for k, v in cmd_d.iteritems():
for k, v in cmd_d.items():
if k in sh_out:
return v

Expand Down Expand Up @@ -110,20 +109,20 @@ def run_pi(self):
def build_menu(self):
menu = Gtk.Menu()

item_unlock = Gtk.MenuItem('Unlock')
item_unlock = Gtk.MenuItem(label='Unlock')
item_unlock.connect('activate', self.unlock)
menu.append(item_unlock)
self.item_unlock = item_unlock
self.item_unlock.set_sensitive(False) # default state

item_help = Gtk.MenuItem('Help')
item_help = Gtk.MenuItem(label='Help')
item_help.connect('activate', self.open_help)
menu.append(item_help)

separator = Gtk.SeparatorMenuItem()
menu.append(separator)

item_quit = Gtk.MenuItem('Quit')
item_quit = Gtk.MenuItem(label='Quit')
item_quit.connect('activate', self.quit)
menu.append(item_quit)

Expand All @@ -149,7 +148,7 @@ def quit(self, *arg):

def update_icon(self):
while True:
if self.pi_q.qsize > 0:
if self.pi_q.qsize() > 0:
state = self.pi_q.get()

if state == ON_SIGNAL:
Expand Down Expand Up @@ -199,7 +198,6 @@ class AsynchronousFileReader(Thread):
"""

def __init__(self, fd, queue):
assert isinstance(queue, Queue)
assert callable(fd.readline)
Thread.__init__(self)
self._fd = fd
Expand Down