示例#1
0
import os
import time
import platform
import socket
import subprocess
import datetime
try:
    from Notify import Main
    Notify = Main()
    Notify.SetMode("C")
except ImportError:
    print("[UTLS][!] Failed to import Notify.")
    exit()

class Main():
    def __init__(self):
        ## 0 = Windows
        ## 1 = Linux
        ## 2 = Debug
        self.EnvironmentDefined = False
        if self.EnvironmentDefined == False:
            pass
            #Notify.Error("Environment Undefined.")
        self.Environment = 0

    def SetDeviceEnvironment(self, Environment):
        if Environment == "Linux":
            self.Environment = 1
        elif Environment == "Windows":
            self.Environment = 0
        else:
示例#2
0
## Notify Test Script
import os
try:
    from Notify import Main as NotifyMain
    Notify = NotifyMain()
    Notify.SetMode("A")
except (ImportError):
    print("[!] Failed to import Notify. Aborting.")
    exit()

print("Beginning test...")

Notify.Test()

print("#####")

Notify.Red()
print("RED")
Notify.Green()
print("GREEN")
Notify.Yellow()
print("YELLOW")
Notify.Blue()
print("BLUE")
Notify.Magenta()
print("MAGENTA")
Notify.Cyan()
print("CYAN")
Notify.White()
print("WHITE")
Notify.ClearColour()
示例#3
0
## Messenger application. Basedd off PyMessenger by Tijndagamer
## Released under the MIT licence.
# You rock, man.

## Import stage.

try:
    from Notify import Main
    Notify = Main()
    Notify.SetMode("C")
    Notify.Success("Successfully imported Notify.")
except(ImportError):
    print("[!] Failed to import Notify.py")

try:
    from utilsv2 import Main as UtilsMain
    utils = UtilsMain()
    utils.SetDeviceEnvironment(0)
except:
    print("[!] Failed to import utils")
    exit()
import socket
import time
import sys

class MessengerClient():
    def __init__(self):
        self.HostIP = ''
        self.Port = 5005
        self.BufferSize = 1024
        self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
示例#4
0
try:
    from Notify import Main
    Notify = Main()
    Notify.SetMode("C")
except (ImportError):
    print("Failed to import Notify.")


class Main():
    def __init__(self):
        self.host = ""
        self.port = 0
        self.user = ""
        self.psw = ""
        self.hash = ""
        self.psarray = []
        self.msk = ""

    def GetNewData(self):
        while True:
            try:
                self.host = input("[Host]> ")
                if len(self.host) > 15:
                    Notify.Error("Incorrect Host.")
                else:
                    break
            except (ValueError):
                Notify.Error("Incorrect Host.")
        while True:
            try:
                self.port = int(input("[Port]> "))
示例#5
0
## Advanced Text Manipulation (AdvText)

import time
import random
import os
try:
    from Notify import Main as NotifyMain
    Notify = NotifyMain()
    Notify.SetMode("A")
except (ImportError):
    print("[ATX] Failed to import Notify. Aborting.")
    exit()


class Main:
    def __init__(self):
        self.AvailForeColours = [
            "RED", "GREEN", "CYAN", "YELLOW", "BLUE", "MAGENTA", "WHITE"
        ]
        self.AvailBackColours = [
            "BLACK", "RED", "GREEN", "YELLOW", "BLUE", "MAGENTA", "CYAN",
            "WHITE"
        ]
        self.AvailStyles = ["DIM", "BRIGHT", "NORMAL"]

    def LoadingEllipsis(self, Text, Delay, Count, CompletionMessage):
        print(Text, end='')
        for count in range(0, Count):
            print(".", end='')
            time.sleep(Delay)
        print(CompletionMessage)
示例#6
0
## Simple script to send/receive morse data through audio link connected to radio.
## On/Off variable controlled by relay
import platform
import time
try:
    from Notify import Main as NotifyMain
    Notify = NotifyMain()
    Notify.SetMode("A")
    Notify.Success("Notify Imported.")
except(ImportError):
    print("Unable to import notify. Aborting.")
    exit()

try:
    from utilsv2 import Main as UtilsMain
    utils = UtilsMain()
    if platform.system() == "linux":
        utils.SetDeviceEnvironment(1)
    else:
        utils.SetDeviceEnvironment(0)
except(ImportError):
    Notify.Error("Failed to import Utils.")
    exit()


try:
    import RPi.GPIO as GPIO
    Notify.Success("Imported GPIO modules")
    GPIOstate = True
except(ImportError):
    Notify.Error("Failed to import GPIO modules.")
示例#7
0
文件: V2.py 项目: Storm7874/DashOS
FirstRun = True
import random
import os
import datetime
try:
    from Notify import Main as NotifyMain
    Notify = NotifyMain()
except (ImportError):
    print("Failed to import Notify")
try:
    import RPi.GPIO as GPIO
    Notify.Success("Imported GPIO Modules.")
    GPIOstate = True
except (ImportError):
    Notify.Warning("Failed to import GPIO Modules. Attempting substitute...")
    GPIOstate = False
    try:
        from EmulatorGUI import GPIO
        Notify.Success("Imported eGPIO Modules.")
    except (ImportError):
        print("Failed to import GPIO Modules.")

try:
    from utilsv2 import Main as UtilsMain
except (ImportError):
    print("Failed to import Utils")
utils = UtilsMain()
import time

OilPin = 3
HandbrakePin = 5
示例#8
0
try:
    from Notify import Main as NotifyMain
    Notify = NotifyMain()
except (ImportError):
    print("[!] Failed to import Notify.")
    exit()

Notify.SetMode("C")
Notify.Success("Imported Notify (Mode C)")

# Inputs
InputOne = 0
InputTwo = 0
InputThree = 0
InputFour = 0

#outputs

Fuel = 3
OilWarning = 5
BatteryWarning = 7
Handbrake = 8
BrakeLining = 10
BrakeWarning = 12
Backlight = 11
IndicateLeft = 13
IndicateRight = 15
MainBeam = 16
ABS = 18

Notify.Info("Beginning Hardware Setup")
示例#9
0
#v1.0

## Initiate import stage

try:
    from Notify import Main
    Notify = Main()
    Notify.SetMode("C")
    # Import Notify.py, for handling of colour based commands and messages
except (ImportError):
    print("[!] Failed to import Notify.py")
    exit()

Notify.Info("DTT Version 4.0 (DTTR)")
print()

try:
    import RPi.GPIO as GPIO
    #Attempt to import Pi-based GPIO interface module. If these are unavailable, The emulated version is imported,
    #As well as this, should these modules be unavailable, the program will assume it is not running on a linux
    #based environment, and instead in a testing scenario.
    Notify.Success("Imported GPIO modules")
    GPIOstate = True
except (ImportError):
    Notify.Error("Failed to import GPIO modules.")
    GPIOstate = False
    Notify.Warning("Attempting to import eGPIO modules.")
    #print(Fore.YELLOW + "[!] Attempting to import eGPIO modules")
    try:
        from EmulatorGUI import GPIO
        Notify.Success("Successfully imported eGPIO modules")