-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Damien Jeandemange <damien.jeandemange@gmail.com>
- Loading branch information
1 parent
5488efd
commit f87f98a
Showing
6 changed files
with
76 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# | ||
# Copyright (c) 2024, Damien Jeandemange (https://github.com/jeandemanged) | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
# | ||
import os | ||
import tkinter as tk | ||
|
||
import pandas as pd | ||
import pypowsybl.network as pn | ||
|
||
from yagat.app_context import AppContext | ||
from yagat.frames.impl.base_list_view import BaseListView | ||
|
||
|
||
class BusesBusBreakerViewListView(BaseListView): | ||
|
||
def __init__(self, parent, context: AppContext, *args, **kwargs): | ||
BaseListView.__init__(self, parent, context, *args, **kwargs) | ||
|
||
@property | ||
def tab_name(self) -> str: | ||
return 'Buses (Bus/Breaker View)' | ||
|
||
def get_data_frame(self) -> pd.DataFrame: | ||
return self.context.network_structure.buses_bus_breaker_view | ||
|
||
def filter_data_frame(self, df: pd.DataFrame, voltage_levels: list[str]) -> pd.DataFrame: | ||
return df.loc[df['voltage_level_id'].isin(voltage_levels)] | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
if os.name == 'nt': | ||
# Fixing the blur UI on Windows | ||
from ctypes import windll | ||
|
||
windll.shcore.SetProcessDpiAwareness(2) | ||
root = tk.Tk() | ||
ctx = AppContext(root) | ||
bw = BusesBusBreakerViewListView(root, ctx) | ||
bw.pack(fill="both", expand=True) | ||
ctx.network = pn.create_ieee9() | ||
ctx.selection = ('network', '', None) | ||
ctx.selected_tab = bw.tab_name | ||
root.mainloop() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters