Exemple #1
0
    def __init__(self, screen: Surface, map_: str, heroes: int, monsters: int,
                 items: int):
        """  Создаёт игру
        :param heroes: колличество героев в игре. Если players_count=0, то создаст читера.
        """
        self.start_time = datetime.now()
        self.screen = screen
        # map
        self.map: Map = self._init_map(map_)  # карта
        self.maps: Group = Group(self.map)
        # sprites
        self.characters: Group = Group()  # спрайты с героями и монстрами
        self.heroes: Group = self._init_heroes(heroes)  # спрайты с героями
        self.monsters: Group = self._init_monsters(
            monsters)  # спрайты с монстрами
        self.items: Group = self._init_items(items)  # спрайты с вещами

        self._start_turn()
        self.dashboard = Dashboard(self)  # приборная панель
        self.backpack: Backpack = Backpack(self)  # рюкзак
        self.controls: Controls = Controls(self)  # help
        self.monsters_killed = 0
Exemple #2
0
    def __init__(self, surface):
        self.surface = surface
        self.state = const.MENU
        self.level = 1
        self.dashboard = Dashboard(self.surface)
        self.ship = Ship(self.surface, LEVEL_DATA[self.level]['start_fire'])
        self.active_text_box = None # can only have one at a time

        self.f_tick_time = 5   # seconds between fire ticks
        self.f_anim_time = 0.4 # seconds between fire animation frames
        self.last_f_tick = time.time()
        self.last_f_anim = time.time()

        self.s_tick_time = 2   # seconds between sprinkler ticks
        self.last_s_tick = time.time() - 0.5 # offset so they don't happen simultaneously
        self.event_room = None
        self.event_target_flvl = 0
        self.event_time = 20
        self.event_start_time = 0

        self.repair_room = None
        self.repair_time = 7
        self.repair_start_time = 0

        self.r_tick_time = 2   # seconds between radar ticks
        self.last_r_tick = time.time() - 1.5 # offset so they don't happen simultaneously

        self.lightyear_length = 10 # seconds it takes to travel 1 lightyear
        self.last_lightyear_tick = time.time()
        self.lightyears_left = 9

        self.damage_anim_start = 0

        self.is_paused = False
        self.time_paused = None

        self.shield_room_id = 0

        self.tut_progress = 0
Exemple #3
0
 def savesettings_func(self):
     if self.existingpath.text() == '':
         path = self.setpath.text()
         userdata = jsondata()
         userdata.setdatapath(path + '/pdm_database')
         # creating pdm_database folder according to given path
         dirpath = os.path.join(path, 'pdm_database')
         os.mkdir(dirpath)
         dirpath = os.path.join(dirpath, 'images')
         os.mkdir(dirpath)
         # open dashboard
         self.dashboard = Dashboard()
         self.dashboard.location_on_the_screen()
         self.dashboard.show()
         self.close()
     elif self.setpath.text() == '':
         path = self.existingpath.text()
         userdata = jsondata()
         userdata.setdatapath(path)
         self.close()
     elif self.existingpath.text() != '' and self.setpath.text() != '':
         QMessageBox.about(self, "Error",
                           "You must provide only one of them.")
Exemple #4
0
    Path(TARGET_DIR).mkdir()
if not Path(CACHE_DIR).exists():
    Path(CACHE_DIR).mkdir()

clear_target()
clear_cache()

if not CACHE_DIR.joinpath('log.log').exists():
    CACHE_DIR.joinpath('log.log').open(mode='w')

logging.getLogger('werkzeug').setLevel(logging.ERROR)
logging.basicConfig(
    filename=CACHE_DIR.joinpath('log.log').as_posix(),
    filemode='a',
    level=logging.INFO,
    format='%(asctime)s,%(msecs)d | %(levelname)s — %(message)s',
    datefmt='%H:%M:%S')

# overwrite automated QApplication from ApplicationContext to include flags
# ApplicationContext.app = QApplication(sys.argv)

appctxt = ApplicationContext()  # 1. Instantiate ApplicationContext

main_window = QMainWindow()

db = Dashboard()
db.show()

exit_code = appctxt.app.exec_()  # 2. Invoke appctxt.app.exec_()
sys.exit(exit_code)
Exemple #5
0
    system_priv_user = sys.argv[2]  # the "Privileged" system user
    log.info("Will run the PTY manager using the unprivileged user: {}".format(
        system_up_user))
    log.info("Will run the PTY manager using the privileged user:   {}".format(
        system_priv_user))

    log.info("Libauto version:    {}".format(libauto_version))
    log.info("Controller version: {}".format(cio_version))

    print_all("Libauto version:    {}".format(libauto_version))
    print_all("Controller version: {}".format(cio_version))

    consumers = [
        PtyManager(system_up_user, system_priv_user),
        Verification(),
        Dashboard(),
    ]

    send_queue = queue.Queue(maxsize=100)

    delegate = StandardDelegate(consumers, send_queue)

    ws_connection = WebSocketConnection(delegate, get_token, BASE_URL)

    ws_thread = Thread(target=run_forever, args=(ws_connection, send_queue))
    ws_thread.deamon = True
    ws_thread.start()

    rpc_server = ThreadedServer(CdpService, port=18864)

    prc_server_thread = Thread(target=rpc_server.start)
Exemple #6
0
from dashboard import Dashboard
from hoard import Hoard
from multiprocessing import Queue, Manager, log_to_stderr
from packing import human2bin
import csv
import logging
import sys

if __name__ == "__main__":
    logger = log_to_stderr()
    logger.setLevel(logging.INFO)
    queue = Queue()
    pre = dict()
    with open("base.csv", newline='', encoding="utf-8") as csvfile:
        reader = csv.reader(csvfile)
        for row in reader:
            if len(row) == 2:
                pre[human2bin(row[0])] = float(row[1])
    games = 8
    h = Hoard(queue, games, 2)
    d = Dashboard(queue, games)
    if len(sys.argv) > 1:
        start = sys.argv[1]
    else:
        start = "1011::"
    h.run(start, pre, logger)
    d.run(queue)
 def dashboard_frame(self):
     frame = Dashboard(self.par, self.con, self.user_id, self.user_name,
                       self.data)
     frame.grid(row=0, column=0, sticky="nsew")
     frame.tkraise()
Exemple #8
0
                external_scripts=external_scripts,
                external_stylesheets=external_stylesheets,
                server=server)

# app=dash.Dash(name = __name__, server = server)
if not os.path.exists('tmp'):
    os.mkdir('tmp')
DIRECTORY_PATH = r'tmp//'

#app = dash.Dash()

app.scripts.config.serve_locally = False

app.config['suppress_callback_exceptions'] = True

custom_dush = Dashboard()

#prodapt=html.Div(html.Img(src='http://www.prodapt.com/wp-content/uploads/logo_prodapt.png')),
#vs=html.H1('vs')
#reinfer=html.Div(html.Img(src='https://d1qb2nb5cznatu.cloudfront.net/startups/i/703763-82fa920eed7d56e7cdcee1b1d9a30b14-medium_jpg.jpg?buster=1440002957')),

#logo=custom_dush.three_columns_grid(prodapt,vs,reinfer)

app.layout = html.Div([
    #    logo,
    dcc.Upload(
        id='upload-data',
        children=html.Div(['Drag and Drop or ',
                           html.A('Select Files')]),
        style={
            'width': '100%',
Exemple #9
0
from NoteDB import NoteDB
from dashboard import Dashboard

#try:
# Add Your Database username and password here
db = NoteDB(username="******", password="******")
Dashboard().initUI(db)

#except Exception as e:
#   messagebox.showinfo("Error", "Unable to establish database connection.")
Exemple #10
0
    def register(self):
        global start_widget
        last_name = start_widget.lastnameEntry.text()
        print(last_name)
        first_name = start_widget.firstnameEntry.text()
        middle_name = start_widget.middlenameEntry.text()
        email = start_widget.emailEntry.text()
        dob = start_widget.dobEntry.selectedDate().toString("yyyy-MM-dd")
        sex = 0  #default
        if start_widget.femaleSexEntry.isChecked():
            sex = 1
        address = start_widget.addressEntry.toPlainText()
        clinic_address = start_widget.clinicAddressEntry.toPlainText()
        degree = start_widget.degreeEntry.text()
        field = start_widget.fieldEntry.text()
        password = start_widget.passwordEntry.text()
        confpassword = start_widget.confpasswordEntry.text()
        if password != confpassword:
            print("Passwords do not match!!!")
        else:
            payload = {
                'first_name': first_name,
                'last_name': last_name,
                'middle_name': middle_name,
                'email': email,
                'password': password,
                #'dob' : dob,
                #'sex' : sex,
            }

            if self.checkInternetConn():
                ourRequest = req.post(up.urljoin(host_url,
                                                 'api/v1/patient_/user/'),
                                      data=payload)

                print(ourRequest.text)
                print(ourRequest.status_code)

                #if status code is 201, then perform this logic, else re-register
                response_data = json.loads(ourRequest.text)
                id = response_data.get('id')
                token_payload = {
                    'email': email,
                    'password': password,
                }
                token = self.obtain_token(token_payload)
                if self.verify_token(token):
                    #register practitioner
                    Auth_data = "JWT {}".format(token)
                    headers = {'Authorization': Auth_data}

                    ourRequestkaResponse = req.post(up.urljoin(
                        host_url, '/api/v1/patient_/medical_practitioner/'),
                                                    headers=headers)

                    response_data = json.loads(ourRequestkaResponse.text)
                    print(ourRequestkaResponse)
                    result = response_data.get('results')
                    c = self.conn.cursor()
                    c.execute(
                        """INSERT INTO auth_token_data(token, created_at) VALUES (?, ?)""",
                        (token, timestamp))

                else:
                    #re-register
                    dashboard_widget = Dashboard(self)
                    #log in to dashboard
                    dashboard = Dashboard(self)
                    self.central_widget.addWidget(dashboard)
                    self.central_widget.setCurrentWidget(dashboard)

                    #define methods to access on clicking buttons
                    dashboard.makeRecordEntryButton.clicked.connect(
                        self.chooseCase)
                    dashboard.viewProfileButton.clicked.connect(
                        self.viewProfile)
                    dashboard.registerPatientButton.clicked.connect(
                        self.register_patient)
                    dashboard.viewPatientRecordButton.clicked.connect(
                        self.viewRecord)
Exemple #11
0
 def dashboard(self, *args, **kwargs):
     return Dashboard(self.session, *args, user_id=self.user_id, **kwargs)
Exemple #12
0
""" 
    
    Unit tests to ensure system components are functioning properly.

    Test Categories:
        - Company
        - Market
        - Visual
        
"""

# intialize dashboard and connect to database
from dashboard import Dashboard
d = Dashboard(['msft'])

# keep track of failed components
failed = []


"""

    Company Tests
    
"""

print('\nRunning unit tests...\n')

for data_type in ['json','dict','df']:
    for symbol in ['msft']:
        
        # analyst_info
Exemple #13
0
def main():
    """
    Main function used to convert a datadog json file into a terraform file.
    """
    # with open("../project8/dashboard.json") as f:
    # with open("../project8/mongodb.json") as f:
    # with open("../project8/mongo.json") as f:
    # with open("../project8/business.json") as f:
    # with open("../project8/uptime.json") as f:
    # with open("../project8/alb_performance.json") as f:
    # with open("../project8/status_errors.json") as f:
    # with open("../project8/status_errors.json") as f:
    # with open("../project8/response_time.json") as f:
    # with open("../project8/aws_elb.json") as f:
    # with open("../project8/jvm_metrics.json") as f:
    # with open("../project8/k8s_pods.json") as f:
    # with open("../project8/aws_ec2.json") as f:
    # with open("../project8/jvm_overview.json") as f:
    # with open("../project8/alb_cloned.json") as f:
    # with open("../project8/k8s_services.json") as f:
    # with open("../project8/aws_ec2_cloned.json") as f:
    # with open("../project8/trace_analytics.json") as f:
    # with open("../project8/system_metrics.json") as f:
    # with open("../project8/aws_mq.json") as f:
    # with open("../project8/aws_autoscaling.json") as f:
    # with open("../project8/aws_billing.json") as f:
    # with open("../project8/aws_s3.json") as f:
    # with open("../project8/azure_api.json") as f:
    # with open("../project8/azure_overview.json") as f:
    # with open("../project8/aws_document.json") as f:
    # with open("../project8/redis.json") as f:
    # with open("../project8/aws_kinesis.json") as f:
    # with open("../project8/aws_kinesis_firehose.json") as f:
    # with open("../project8/aws_lambda.json") as f:
    # with open("../project8/aws_rds.json") as f:
    # with open("../project8/aws_sqs.json") as f:
    # with open("../project8/aws_step_functions.json") as f:
    # with open("../project8/aws_trusted_advisor.json") as f:
    # with open("../project8/azure_app_service.json") as f:
    # with open("../project8/azure_batch.json") as f:
    # with open("../project8/azure_cosmosdb.json") as f:
    # with open("../project8/azur_dbmsql.json") as f:
    # with open("../project8/azure_dbpostgres.json") as f:
    # with open("../project8/azure_event_hub.json") as f:
    # with open("../project8/azure_functions.json") as f:
    # with open("../project8/azure_iot_hub.json") as f:
    # with open("../project8/azure_loadbalancing.json") as f:
    # with open("../project8/azure_logicapp.json") as f:
    # with open("../project8/azure_overview#1.json") as f:
    # with open("../project8/azure_databases.json") as f:
    # with open("../project8/azure_usage.json") as f:
    # with open("../project8/azure_vm.json") as f:
    # with open("../project8/azure_vm_scale.json") as f:
    # with open("../project8/azure_cont.json") as f:
    # with open("../project8/azure_coredns.json") as f:
    # with open("../project8/docker_overview.json") as f:
    # with open("../project8/host_count.json") as f:
    # with open("../project8/k8s_daemonset.json") as f:
    # with open("../project8/k8s_deployment.json") as f:
    # with open("../project8/k8s_replicaset.json") as f:
    # with open("../project8/k8s_overview.json") as f:
    # with open("../project8/run_errors.json") as f:
    # with open("../project8/rum_mobile.json") as f:
    # with open("../project8/system_diskio.json") as f:
    # with open("../project8/system_networking.json") as f:
    # with open("../project8/troubleshoot.json") as f:
    # with open("../project8/load_test.json") as f:
    # content = json.load(f)

    args = get_arguments()
    set_logging(args.verbose)

    try:
        datadog_type = args.type
        datadog_json = args.json
        terraform_file = args.output
        terraform_resource_name = args.resource

        if datadog_type in ["dashboard", "monitor"]:
            logging.info(
                f" Converting Json file {datadog_json} of type {datadog_type} ..."
            )

            # read datadog json file.
            with open(datadog_json, "r") as f:
                datadog_json_dict = json.load(f)

            # initiliaze dashboard converter instance.
            dashboard_converter = Dashboard(
                datadog_json_dict) if datadog_type == "dashboard" else Monitor(
                    datadog_json_dict)

            # create terraform code.
            with open(terraform_file, "w") as f:
                f.write(
                    dashboard_converter.to_Terraform_Code(
                        terraform_resource_name))

            logging.info(
                f" Terraform file [ {terraform_file} ] has been created")
            logging.info(
                f" For reformating run => [ terraform fmt {terraform_file} ]")

    except BaseException as e:
        logging.exception("Uncaught exception: %s: %s",
                          type(e).__name__, str(e))
Exemple #14
0
from dashboard import Dashboard
import math
import time
import sys
from cleanup import set_cleanup_callback
from letter import initialize_font

# mc=minecraft.Minecraft.create()
# mc.postToChat("hello world")

if __name__ == '__main__':
    fetch.initialize()
    initialize_font()
    mc = minecraft.Minecraft.create("172.86.162.69")
    dashboards = []

    # Load dashboards
    for arg in sys.argv[1:]:
        dashboards.append(Dashboard(arg, mc))

    set_cleanup_callback(
        lambda: [dashboard.cleanup() for dashboard in dashboards])

    # Run the update every n seconds
    while True:
        print("drawing %d dashboard(s), pos: %s" %
              (len(dashboards), mc.player.getTilePos()))
        for dashboard in dashboards:
            dashboard.update()
        time.sleep(5)
Exemple #15
0
from PyQt5 import QtCore, QtGui, QtWidgets
import PyQt5
import sys

from dashboard import Dashboard

if __name__ == '__main__':
    # this declares the event loop
    # every qt application requires this line to get running
    app = QtWidgets.QApplication(sys.argv)

    # add all the components that need to be ran under this comment (usually its the main display)
    # in this case it is the videowidget
    videowidget = Dashboard()
    videowidget.show()

    # start the event loop
    app.exec()
Exemple #16
0
    def getparams(self):
        print "please enter the dimensions you want.You have the following options: "
        for item in self.mart.dimensions.keys():
            print item
        self.params = self.mart.dimensions.keys()


#mygreeter = greeter()
#unique_id,mart,metric,aggregation,timeseries,timerange,params = mygreeter.main()
unique_id, mart, metric, aggregation, timeseries, timerange, params = 'Abhishek', 'flight_paymentdetails', 'Gross Margin', 'SUM', 'bookingdate', (
    'date', '2012-05-14', '2012-05-14'), [
        'airline', 'source', 'destination', 'sector', 'city', 'status',
        'bookingflag', 'typeoftravel'
    ]
mydashboard = Dashboard(unique_id, mart, metric, aggregation, timeseries,
                        timerange, params)


def ask():
    choice = raw_input("Press 0 to continue and 1 to exit : ")
    if choice == '1':
        mydashboard.exit()
    else:
        mydashboard.interact()
        ask()


mydashboard.process()
mydashboard.render()
ask()
Exemple #17
0
# In[6]:

bar = (Bar().add_xaxis(["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]).add_yaxis(
    "商家A", [5, 20, 36, 10, 75, 90]).set_global_opts(
        title_opts=opts.TitleOpts(title="主标题", subtitle="副标题")))
chart = boxpolt_base()

# In[8]:

#from pyecharts_dashboard.dashboard import Dashboard
from dashboard import Dashboard

# In[10]:

#示例化对象,需设置浏览器类型
dashboard = Dashboard('chrome')

# In[11]:

#添加图纸1
dashboard.add(bar)

# In[12]:

#添加图纸2
dashboard.add(chart)

# In[13]:

#打开UI界面
dashboard.render()
    def dashboard(self, validate_var_dict):
        filterdDf = readFromExcel(validate_var_dict)

        self.root.destroy()
        dashboardTk = Dashboard(filterdDf)
Exemple #19
0
def create_app(doc, default_dir=".", update=10):
    """Creates a Bokeh document that the server will display"""
    # start loading the dashboard
    log.info(f"Creating Bokeh app")
    log.debug(f"Default directory: {os.path.realpath(default_dir)}")
    log.debug(f"Update rate for mdinfo callback: {update}s")
    doc.title = "DashMD"
    document = Dashboard(default_dir)

    def callback_load_dir(new_value):
        if document.anim_button.active:
            document.anim_button.label = "◼ Stop"
            document.anim_button.button_type = "danger"
            document.autocomp_results.children = []
            global mdinfo_callback
            # first update of the dashboard
            document.get_mdout_files()
            document.parse_mdinfo()
            for mdout in document.mdout_files[:document.slider.value]:
                document.read_mdout_header(mdout)
            document.display_simulations_length()
            document.mdinfo_callback = doc.add_periodic_callback(document.update_dashboard, update*1e3)
        else:
            document.anim_button.label = "▶ Load"
            document.anim_button.button_type = "success"
            doc.remove_periodic_callback(document.mdinfo_callback)
    document.anim_button.on_click(callback_load_dir)

    # arrange display with tabs
    dashboard = Panel(
        title="Dashboard",
        child=grid([
        row([
            column([document.md_dir, document.autocomp_results]),
            document.anim_button,
        ]),
        row([
            column([document.pie]),
            column([
                document.progressbar,
                document.calc_speed,
                document.eta,
                document.last_update,
                document.slider,
            ]),
        ]),
        row([document.bar]),
        row([document.mdout_sel, document.mdout_button]),
        ], sizing_mode="scale_both")
    )
    temp_tab = Panel(title="Temperature", child=document.temperature_fig)
    press_tab = Panel(title="Pressure", child=document.pressure_fig)
    e_tab = Panel(title="Energy", child=document.energy_fig)
    vol_tab = Panel(title="Volume", child=document.vol_fig)
    dens_tab = Panel(title="Density", child=document.density_fig)
    rmsd_tab = Panel(title="RMSD", child=grid([column([
        row([document.topology, document.trajectory, document.rmsd_button]),
        document.rmsd_fig,
    ])]))
    view_tab = Panel(title="View", child=grid([
        column([
            row([document.topology, document.trajectory, document.view_button]),
            document.view_canvas,
        ])
    ]))
    tabs = Tabs(tabs=[ dashboard, view_tab, rmsd_tab, temp_tab, press_tab, e_tab, vol_tab, dens_tab])
    doc.add_root(tabs)
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html

from navbar import Navbar
from sidebar import Sidebar
from dashboard import Dashboard

nav = Navbar()
side = Sidebar()
dashboard = Dashboard()

body = dbc.Container(
    [
        dbc.Row([
                    dbc.Col(html.Div(side), lg=2),
                    dbc.Col(html.Div(dashboard)),
        ])
    ],
    fluid=True
)


def Homepage():
    layout = html.Div([
    nav,
    body
    ])
    return layout
Exemple #21
0
from tkinter import messagebox
from notedb import NoteDB
from dashboard import Dashboard

if __name__ == "__main__":
    try:
        db = NoteDB()  #initializing connection with database
        Dashboard().initUI(db)  #initializing Interface
    except Exception as e:
        messagebox.showinfo("Error",
                            "Unable to establish database connection.")
Exemple #22
0
import db
import abstractDriver
import messageAnnouncer
from api import dbAPI
from story import Story
from api import adminAPI
from api import streamAPI
from api import scrapeAPI
from dashboard import Dashboard


announcer = messageAnnouncer.MessageAnnouncer()
abstractDriver = abstractDriver.AbstractDriver(announcer)
instance = db.Database(announcer)
app = Flask(__name__)
Dashboard(app, instance)
Story(app, instance)


app.register_blueprint(adminAPI.constructBlueprint(
        announcer,
        instance,
        abstractDriver
    ),
    url_prefix="/admin"
)
app.register_blueprint(streamAPI.constructBlueprint(
        announcer,
        instance,
        abstractDriver
    ),
Exemple #23
0
    def __load_features__(self):
        self.products = M()
        self.products['_porder'] = L()
        greg('PRODUCTS', self.products)
        for p in PRODUCT_ORDER:
            self.products._porder << p.lower()

        p_paths = Dir.showall('product/')
        for p_path in p_paths:
            if not Dir.isDir(p_path) or not Dir.isDir(p_path): continue
            p_raw = os.path.split(p_path)[-1]
            p_name = p_raw.lower()
            p_code = p_name
            p_url = '/' + p_name + '/'
            p_title = p_raw.replace('_', ' ')
            self.products[p_name] = M()
            self.products[p_name]['_name'] = p_name
            self.products[p_name]['_code'] = p_code
            self.products[p_name]['_url'] = p_url
            self.products[p_name]['_title'] = p_title

            # Add-on Feature
            features = NameSpace(p_path, inherited=nameof(Feature))
            for f_raw, f_mod in iterkv(features):
                f_name = f_raw.lower()
                f_code = p_code + '_' + f_name
                f_url = p_url + f_name + '/'
                f_title = f_raw.replace('_', ' ')

                for cls_code, cls_obj in iterkv(f_mod):
                    if classof(cls_obj, Feature) and not classof(
                            cls_obj,
                            SubFeature) and nameof(cls_obj) != nameof(Feature):
                        self.products[p_name][f_name] = cls_obj.NEW()
                        self.products[p_name][f_name]['_term'] = True
                        self.products[p_name][f_name]['_name'] = f_name
                        self.products[p_name][f_name]['_code'] = f_code
                        self.products[p_name][f_name]['_url'] = f_url
                        self.products[p_name][f_name]['_title'] = f_title
                        if cls_obj.__doc__ != None:
                            self.products[p_name][f_name][
                                '_desc'] = ' ' + cls_obj.__doc__
                        if cls_obj.__doc__ == None:
                            self.products[p_name][f_name]['_desc'] = ''
                        break

                for cls_raw, cls_obj in iterkv(f_mod):
                    if classof(cls_obj, SubFeature
                               ) and nameof(cls_obj) != nameof(SubFeature):
                        cls_name = cls_raw.lower()
                        cls_code = f_code + '_' + cls_name
                        cls_url = f_url + cls_name + '/'
                        cls_title = cls_raw.replace('_', ' ')
                        self.products[p_name][f_name]['_term'] = False
                        self.products[p_name][f_name][cls_name] = cls_obj.NEW()
                        self.products[p_name][f_name][cls_name]['_term'] = True
                        self.products[p_name][f_name][cls_name][
                            '_name'] = cls_name
                        self.products[p_name][f_name][cls_name][
                            '_code'] = cls_code
                        self.products[p_name][f_name][cls_name][
                            '_url'] = cls_url
                        self.products[p_name][f_name][cls_name][
                            '_title'] = cls_title
                        if cls_obj.__doc__ != None:
                            self.products[p_name][f_name][cls_name][
                                '_desc'] = ' ' + cls_obj.__doc__
                        if cls_obj.__doc__ == None:
                            self.products[p_name][f_name][cls_name][
                                '_desc'] = ''

            # Ordering
            order = Module(p_path + '/__init__.py')
            self.products[p_name]['_forder'] = L()
            for f in order.FEATURE_ORDER:
                if '.' in f:
                    self.products[p_name]._forder << (f.lower().split('.')[0],
                                                      f.lower().split('.')[1])
                else:
                    self.products[p_name]._forder << f.lower()

        # Dashboard
        self.products['dashboard'] = Dashboard()
        self.products.dashboard['_term'] = True
        self.products.dashboard['_name'] = 'dashboard'
        self.products.dashboard['_code'] = 'dashboard'
        self.products.dashboard['_url'] = '/dashboard/'
        self.products.dashboard['_title'] = 'Dashboard'
        self.products.dashboard['_desc'] = 'Cisco Webkit'
Exemple #24
0
    def __init__(self, read_socket):
        super().__init__()

        style = ttk.Style()
        style.theme_use("clam")

        style.configure("Dashboard.TFrame", background=COLOR_LIGHT_BACKGROUND)

        style.configure("BackgroundRED.TFrame", background="red")
        style.configure("BackgroundBLUE.TFrame", background="blue")
        style.configure("BackgroundGREEN.TFrame", background="green")
        style.configure("BackgroundYELLOW.TFrame", background="yellow")
        style.configure("BackgroundPURPLE.TFrame", background="purple")
        style.configure("BackgroundWHITE.TFrame", background="white")
        style.configure("BackgroundORANGE.TFrame", background="orange")
        style.configure("BackgroundPINK.TFrame", background="pink")

        style.configure("Background.TFrame", background=COLOR_PRIMARY)
        style.configure("Dashboard.TLabel",
                        background=COLOR_LIGHT_BACKGROUND,
                        foreground=COLOR_DARK_TEXT,
                        font="Courier 46")

        style.configure("LightText.TLabel",
                        background=COLOR_PRIMARY,
                        foreground=COLOR_LIGHT_TEXT,
                        font=("TkDefaultFont", 11))

        style.configure("Button.TButton",
                        background=[COLOR_SECONDARY],
                        foreground=COLOR_LIGHT_TEXT,
                        font=("TkDefaultFont", 11))

        style.configure("info_button.TButton",
                        background="black",
                        foreground="white",
                        font=("TkDefaultFont", 11))

        style.map("Button.TButton",
                  background=[("active", COLOR_PRIMARY),
                              ("disabled", COLOR_LIGHT_TEXT)])

        SCREEN_WIDTH = self.winfo_screenwidth()
        SCREEN_HEIGHT = self.winfo_screenheight()

        self["background"] = COLOR_PRIMARY

        self.columnconfigure(0, weight=1)
        self.rowconfigure(0, weight=1)

        container = ttk.Frame(self)
        container["height"] = SCREEN_HEIGHT
        container["width"] = SCREEN_WIDTH
        container.grid()
        container.columnconfigure(0, weight=1)

        self.frames = {}
        self.is_powered_on = False

        settings_frame = Settings(container,
                                  self,
                                  lambda: self.show_frame(Dashboard),
                                  height=SCREEN_HEIGHT,
                                  width=SCREEN_WIDTH)
        dashboard_frame = Dashboard(container,
                                    self,
                                    lambda: self.show_frame(Settings),
                                    height=SCREEN_HEIGHT,
                                    width=SCREEN_WIDTH)
        settings_frame.grid(row=0, column=0, sticky="NESW")
        dashboard_frame.grid(row=0, column=0, sticky="NESW")

        self.frames[Settings] = settings_frame
        self.frames[Dashboard] = dashboard_frame

        self.show_frame(Dashboard)

        self.title('ALPHA SOCCER FC v1.0')
        self.geometry(f"{SCREEN_WIDTH}x{SCREEN_HEIGHT}")
        self.resizable(False, False)

        print(SCREEN_HEIGHT, SCREEN_WIDTH)

        self.global_state = State(home_robots=[
            Robot(rid=0, team=1, color="blue", sock=None, x=0, y=0, yaw=0),
            Robot(rid=1, team=1, color="green", sock=None, x=0, y=0, yaw=0),
            Robot(rid=2, team=1, color="red", sock=None, x=0, y=0, yaw=0)
        ],
                                  away_robots=[
                                      Robot(rid=0,
                                            team=2,
                                            color="blue",
                                            sock=None,
                                            x=0,
                                            y=0,
                                            yaw=0),
                                      Robot(rid=1,
                                            team=2,
                                            color="green",
                                            sock=None,
                                            x=0,
                                            y=0,
                                            yaw=0),
                                      Robot(rid=2,
                                            team=2,
                                            color="red",
                                            sock=None,
                                            x=0,
                                            y=0,
                                            yaw=0)
                                  ],
                                  ball=Ball())

        self.read_socket = read_socket

        self.update()
 def dashboard(self, **config):
     from dashboard import Dashboard
     return Dashboard(self, **config)
Exemple #26
0
 def dashboard(self):
     from dashboard import Dashboard
     return Dashboard(self)
Exemple #27
0
import pygame

from dashboard import Dashboard

pygame.init()

SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600

gameDisplay = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
#gameDisplay = pygame.display.set_mode((0,0), pygame.FULLSCREEN)
pygame.display.set_caption('A bit Racey')

clock = pygame.time.Clock()

dashboard = Dashboard(SCREEN_WIDTH, SCREEN_HEIGHT, gameDisplay)

exited = False

while not exited:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            exited = True
        print(event)

    gameDisplay.fill((255, 255, 255))
    dashboard.Update()
    pygame.display.update()
    clock.tick(60)
Exemple #28
0
    def __init__(self, **kwargs):
        super(Main, self).__init__(**kwargs)
        config = ConfigParser()
        config.read('config.ini')
        cfgs = config['sensor_values']

        #setting up widgets
        self.tire_temps = Tire_Temps(pos_hint={
            "center_x": 0.5,
            "y": 0
        },
                                     size_hint=(0.45, 0.25),
                                     temps=[[50, 50, 50, 50], [50, 50, 50, 50],
                                            [50, 50, 50, 50], [50, 50, 50,
                                                               50]],
                                     boundary=int(cfgs['infrared_offset']))
        self.battery = Parametric_Graph(pos_hint={
            "x": 0,
            "y": 0.38
        },
                                        size_hint=(0.25, 0.45),
                                        label='Voltage (V)',
                                        boundaries=[0, 10, 300, 588])
        self.kw = Parametric_Bar(pos_hint={
            "x": 0.02,
            "y": 0.85
        },
                                 size_hint=(0.05, 0.13),
                                 name="Power(kW)",
                                 value=0,
                                 max_value=int(cfgs['kw_max']),
                                 color=[0, 0, 1, 1],
                                 orientation="vertical")
        self.cur = Parametric_Bar(pos_hint={
            "x": 0.09,
            "y": 0.85
        },
                                  size_hint=(0.05, 0.13),
                                  name="Current(A)",
                                  value=0,
                                  max_value=int(cfgs['cur_max']),
                                  color=[0, 0, 1, 1],
                                  orientation="vertical")
        self.vol = Parametric_Bar(pos_hint={
            "x": 0.16,
            "y": 0.85
        },
                                  size_hint=(0.05, 0.13),
                                  name="Voltage(V)",
                                  value=0,
                                  max_value=int(cfgs['vol_max']),
                                  color=[0, 0, 1, 1],
                                  orientation="vertical")
        self.table = Time_Table(pos_hint={
            'x': 0.8,
            'y': 0.65
        },
                                size_hint=(0.2, 0.35))
        self.accel = Accel(pos_hint={
            'center_x': 0.5,
            'y': 0
        },
                           size_hint=(0.15, 0.25),
                           acc=[50, 50])
        #self.map = TrackMap(pos_hint = {'x':0.85, 'y':0.45}, size_hint = (0.18, 0.3))
        self.map = TrackMap2(size_hint=(None, None),
                             size=(Window.width * 0.3, Window.height * 0.5),
                             pos=(Window.width * 0.7, Window.height * 0.2))
        #pos_hint={'x': 0.75, 'y': 0.1}, size_hint=(0.2, 0.35)
        self.pc_status = Pc_Status(pos_hint={
            "x": 0.4,
            "y": 0.85
        },
                                   size_hint=(0.2, 0.15))
        self.apps = Parametric_Bar(pos_hint={
            "x": 0.35,
            "y": 0.65
        },
                                   size_hint=(0.05, 0.13),
                                   name="APPS(%)",
                                   value=0,
                                   max_value=int(cfgs['apps_max']),
                                   color=[0, 1, 0, 1],
                                   orientation="vertical")
        self.brake = Parametric_Bar(pos_hint={
            "x": 0.42,
            "y": 0.65
        },
                                    size_hint=(0.05, 0.13),
                                    name="Brake(%)",
                                    value=0,
                                    max_value=int(cfgs['brake_max']),
                                    color=[1, 0, 0, 1],
                                    orientation="vertical")
        self.bias = Brake_Bias(pos_hint={
            "x": 0.35,
            "y": 0.5
        },
                               size_hint=(0.1, 0.1),
                               percentage=0)
        self.rpmbar = RpmBar(pos_hint={
            "x": 0.35,
            "y": 0.8
        },
                             size_hint=(0.35, 0.05),
                             value=200,
                             max_value=int(cfgs['rpm_max']),
                             color=[1, 0, 0, 1])
        self.motor_temp = Icon_Indicator(pos_hint={
            "x": 0.3,
            "y": 0.35
        },
                                         size_hint=(0.1, 0.1),
                                         name="Motor Temp",
                                         value=0,
                                         unit="°C",
                                         boundaries=[
                                             int(cfgs['motor_temp_warn']),
                                             int(cfgs['motor_temp_crit'])
                                         ],
                                         source="assets/motor_icon.png",
                                         color=[1, 1, 1, 1],
                                         opacity=0.4)
        self.inv_temp = Icon_Indicator(pos_hint={
            "x": 0.4,
            "y": 0.35
        },
                                       size_hint=(0.1, 0.1),
                                       name="Inverter Temp",
                                       value=0,
                                       unit="°C",
                                       boundaries=[
                                           int(cfgs['inv_temp_warn']),
                                           int(cfgs['inv_temp_crit'])
                                       ],
                                       source="assets/inverter2.png",
                                       color=[1, 1, 1, 1],
                                       opacity=0.4)
        self.bat_temp = Icon_Indicator(pos_hint={
            "x": 0.5,
            "y": 0.35
        },
                                       size_hint=(0.1, 0.1),
                                       name="Battery Temp",
                                       value=0,
                                       unit="°C",
                                       boundaries=[
                                           int(cfgs['battery_temp_warn']),
                                           int(cfgs['battery_temp_crit'])
                                       ],
                                       source="assets/battery4.png",
                                       color=[1, 1, 1, 1],
                                       opacity=0.6)
        self.gps_speed = Parametric_Label(pos_hint={
            "x": 0.57,
            "y": 0.65
        },
                                          size_hint=(0.07, 0.1),
                                          name1="0",
                                          name2="GPS Speed",
                                          font1="32sp")
        self.hall_speed = Parametric_Label(pos_hint={
            "x": 0.635,
            "y": 0.65
        },
                                           size_hint=(0.07, 0.1),
                                           name1="0",
                                           name2="Sensor Speed",
                                           font1="32sp")
        self.dashboard = Dashboard(pos_hint={
            "x": 0.01,
            "y": 0.03
        },
                                   size_hint=(0.3, 0.33))
        self.drs_button = Drs_Button(pos_hint={
            "x": 0.5,
            "y": 0.65
        },
                                     size_hint=(0.05, 0.05))
        self.steering_wheel = Icon_Indicator(
            pos_hint={
                "x": 0.48,
                "y": 0.51
            },
            size_hint=(0.07, 0.07),
            name="Steering Angle",
            value=0,
            unit="°",
            boundaries=[100, 120],
            source="assets/steering_wheel2.png",
            color=[0.8, 0.8, 0.8, 1],
            angle=0,
            opacity=1)
        self.downforce = Icon_Indicator(pos_hint={
            "x": 0.6,
            "y": 0.35
        },
                                        size_hint=(0.1, 0.1),
                                        name="Downforce",
                                        value=0,
                                        color=[1, 1, 1, 1],
                                        opacity=0.9,
                                        source="assets/downforce_icon.png")
        self.enc_map = Parametric_Label(pos_hint={
            "x": 0.595,
            "y": 0.49
        },
                                        size_hint=(0.07, 0.1),
                                        name1="0",
                                        name2="Encoder Map",
                                        font1="32sp")

        #adding widgets
        self.add_widget(self.battery)
        self.add_widget(self.tire_temps)
        self.add_widget(self.kw)
        self.add_widget(self.cur)
        self.add_widget(self.vol)
        self.add_widget(self.table)
        self.add_widget(self.accel)
        self.add_widget(self.map)
        self.add_widget(self.pc_status)
        self.add_widget(self.apps)
        self.add_widget(self.brake)
        self.add_widget(self.bias)
        self.add_widget(self.rpmbar)
        self.add_widget(self.motor_temp)
        self.add_widget(self.inv_temp)
        self.add_widget(self.bat_temp)
        self.add_widget(self.gps_speed)
        self.add_widget(self.hall_speed)
        self.add_widget(self.dashboard)
        self.add_widget(self.drs_button)
        self.add_widget(self.steering_wheel)
        self.add_widget(self.downforce)
        self.add_widget(self.enc_map)

        #for testing
        self.bind(data=self.update)
Exemple #29
0
                    tok[1]):
                update_use(tok[2] == "enable", n)
        if tok[0] == "rc":
            if command_name.lower() == tok[3].lower() and int(tok[1]) in roles:
                update_use(tok[2] == "enable", n)
        if tok[0] == "rc":
            if command_name.lower() == tok[3].lower() and int(tok[1]) == user:
                update_use(tok[2] == "enable", n)
    if not can_use:
        raise aoi.PermissionFailed(
            f"Permission #{current_n} - {perms[current_n]} "
            f"is disallowing you from this command")
    return True


dashboard = Dashboard(bot)


def bot_process():
    try:
        bot.logger.info(f"Starting Aoi Bot with PID {os.getpid()}")
        bot.run(os.getenv("TOKEN"))
    except Exception as error:
        traceback.print_exception(type(error),
                                  error,
                                  error.__traceback__,
                                  file=sys.stderr)
        exit(1)


def dashboard_process():
Exemple #30
0
    def __init__(self):
        super().__init__()

        style = ttk.Style()
        style.theme_use("clam")

        style.configure("Dashboard.TFrame", background=COLOR_LIGHT_BACKGROUND)

        style.configure("BackgroundRED.TFrame", background="red")
        style.configure("BackgroundBLUE.TFrame", background="blue")
        style.configure("BackgroundGREEN.TFrame", background="green")
        style.configure("BackgroundYELLOW.TFrame", background="yellow")
        style.configure("BackgroundPURPLE.TFrame", background="purple")
        style.configure("BackgroundWHITE.TFrame", background="white")
        style.configure("BackgroundORANGE.TFrame", background="orange")
        style.configure("BackgroundControlPanel.TFrame", background="#222a2e")
        style.configure("BackgroundGraph.TFrame", background="#334148")

        style.configure("Background.TFrame", background=COLOR_PRIMARY)
        style.configure("Dashboard.TLabel",
                        background=COLOR_LIGHT_BACKGROUND,
                        foreground=COLOR_DARK_TEXT,
                        font="Courier 46")

        style.configure(
            "LightText.TLabel",
            background="#334148",
            foreground="white",
            font=("TkDefaultFont", 22),
        )

        style.configure("LightTextEntry.TLabel",
                        background="#70b88d",
                        foreground="white",
                        font=("TkDefaultFont", 20))

        style.configure("LightText6.TLabel",
                        background="#222a2e",
                        foreground="white",
                        font=("TkDefaultFont", 20))

        style.configure("LightText8.TLabel",
                        background="#334148",
                        foreground="#fff8e7",
                        font=("TkDefaultFont", 80))

        style.configure("LightTextEntry2.TLabel",
                        background="#de9578",
                        foreground="white",
                        font=("TkDefaultFont", 20))

        style.configure("LightTextEntry4.TLabel",
                        background="#bfbb73",
                        foreground="white",
                        font=("TkDefaultFont", 20))

        style.configure("LightTextEntry3.TLabel",
                        background="#978fdb",
                        foreground="white",
                        font=("TkDefaultFont", 20))
        style.configure("LightTextEntry7.TLabel",
                        background='#04a7e0',
                        foreground="white",
                        font=("TkDefaultFont", 20))

        style.configure("Button.TButton",
                        background=[COLOR_SECONDARY],
                        foreground=COLOR_LIGHT_TEXT,
                        font=("TkDefaultFont", 22),
                        activebackground="black")

        style.configure("info_button.TButton",
                        background="black",
                        foreground="white",
                        font=("TkDefaultFont", 11))

        style.map("Button.TButton",
                  background=[("active", COLOR_PRIMARY),
                              ("disabled", COLOR_LIGHT_TEXT)])

        SCREEN_WIDTH = self.winfo_screenwidth()
        SCREEN_HEIGHT = self.winfo_screenheight()

        self["background"] = COLOR_PRIMARY

        self.columnconfigure(0, weight=1)
        self.rowconfigure(0, weight=1)

        container = ttk.Frame(self)
        container["height"] = SCREEN_HEIGHT
        container["width"] = SCREEN_WIDTH
        container.grid()
        container.columnconfigure(0, weight=1)

        self.frames = {}

        dashboard_frame = Dashboard(container,
                                    self,
                                    lambda: self.show_frame(Dashboard),
                                    height=SCREEN_HEIGHT,
                                    width=SCREEN_WIDTH)
        dashboard_frame.grid(row=0, column=0, sticky="NESW")

        self.frames[Dashboard] = dashboard_frame

        self.show_frame(Dashboard)

        self.title('Design Of An Electric Circuit')
        self.geometry(f"{SCREEN_WIDTH}x{SCREEN_HEIGHT}")
        self.resizable(False, False)

        self.update()