Update changeautorotatestatus.py
This commit is contained in:
parent
9e9d59b5ff
commit
700ef1c102
|
@ -2,6 +2,8 @@
|
||||||
import os
|
import os
|
||||||
from gi.repository import Notify
|
from gi.repository import Notify
|
||||||
|
|
||||||
|
path = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
def readFile(path): #self.filename
|
def readFile(path): #self.filename
|
||||||
myDatei = open(path, "r")
|
myDatei = open(path, "r")
|
||||||
myList = []
|
myList = []
|
||||||
|
@ -19,14 +21,14 @@ def writeFile(path, myList): #self.filename
|
||||||
myDatei.writelines(myList)
|
myDatei.writelines(myList)
|
||||||
myDatei.close()
|
myDatei.close()
|
||||||
|
|
||||||
status = readFile('/home/marc/.scripts/status.txt')
|
status = readFile(os.path.join(path, 'status.txt'))
|
||||||
if status[0] == "on":
|
if status[0] == "on":
|
||||||
writeFile('/home/marc/.scripts/status.txt', ["off"])
|
writeFile(os.path.join(path, 'status.txt'), ["off"])
|
||||||
Notify.init ("Rotation-ON")
|
Notify.init ("Rotation-ON")
|
||||||
RotationOFF=Notify.Notification.new ("Rotation","Screenrotation is now turned OFF","dialog-information")
|
RotationOFF=Notify.Notification.new ("Rotation","Screenrotation is now turned OFF","dialog-information")
|
||||||
RotationOFF.show ()
|
RotationOFF.show ()
|
||||||
if status[0] == "off":
|
if status[0] == "off":
|
||||||
writeFile('/home/marc/.scripts/status.txt', ["on"])
|
writeFile(os.path.join(path, 'status.txt'), ["on"])
|
||||||
Notify.init ("Rotation-OFF")
|
Notify.init ("Rotation-OFF")
|
||||||
RotationON=Notify.Notification.new ("Rotation","Screenrotation is now turned ON","dialog-information")
|
RotationON=Notify.Notification.new ("Rotation","Screenrotation is now turned ON","dialog-information")
|
||||||
RotationON.show ()
|
RotationON.show ()
|
||||||
|
|
Loading…
Reference in New Issue