def __init__(self): self.display = (1000, 800) # window'un boyutlari self.mouseX = 0 # mouse hareketinin x koordinati self.mouseY = 0 # mouse hareketinin y koordinati self.flag = False self.flag2 = False self.currentValue = 0 self.antenna = Antenna() self.plane = Plane() self.ground = Ground(100, 100) # ground'un boyutlari self.sidebar = SideBar()
def initModule(self): self.mainpage = MainPage(self) self.sidebar = SideBar(self) self.sidebar.hide() self.tray = TraySet(self) self.tray.show() self.about = AboutMemo() self.about.hide() self.setting = SettingBar(self) self.setting.hide() self.windowIcon = QtGui.QIcon(css.AppIconPath) self.setWindowIcon(self.windowIcon) self.grabKeyboard()
def __init__(self): super(Board, self).__init__() Window.bind(on_key_down=self.on_keyboard_down) self.sidebar = SideBar() self.bindsidebarbutton() self.x1 = self.y1 = 0 self.mode = 0 # 0 for camera and 1 for whiteboard self.draw = False self.erase = False self.canvas = None self.whiteboard = None self.overlaypen = None self.color = (255, 100, 145) self.record = False self.files = list() self.filebox = FileBox() self.popup = Popup(title='Files', title_size=40, title_color=(0, 0, 0, 1), content=self.filebox, background_color=(255, 3, 214, 0.1), background="water.png")
class GtkUI(object): def __init__(self, args): self.daemon_bps = (0, 0, 0) # Setup signals try: import gnome.ui import gnome #Suppress: Warning: Attempt to add property GnomeProgram::*** after class was initialised original_filters = warnings.filters[:] warnings.simplefilter("ignore") try: self.gnome_prog = gnome.init("Deluge", deluge.common.get_version()) finally: warnings.filters = original_filters self.gnome_client = gnome.ui.master_client() def on_die(*args): reactor.stop() self.gnome_client.connect("die", on_die) log.debug("GNOME session 'die' handler registered!") except Exception, e: log.warning( "Unable to register a 'die' handler with the GNOME session manager: %s", e) if deluge.common.windows_check(): from win32api import SetConsoleCtrlHandler from win32con import CTRL_CLOSE_EVENT from win32con import CTRL_SHUTDOWN_EVENT def win_handler(ctrl_type): log.debug("ctrl_type: %s", ctrl_type) if ctrl_type in (CTRL_CLOSE_EVENT, CTRL_SHUTDOWN_EVENT): reactor.stop() return 1 SetConsoleCtrlHandler(win_handler) if deluge.common.osx_check() and Gdk.WINDOWING == "quartz": import gtkosx_application self.osxapp = gtkosx_application.gtkosx_application_get() def on_die(*args): reactor.stop() self.osxapp.connect("NSApplicationWillTerminate", on_die) # Set process name again to fix gtk issue setproctitle(getproctitle()) # Attempt to register a magnet URI handler with gconf, but do not overwrite # if already set by another program. common.associate_magnet_links(False) # Make sure gtkui.conf has at least the defaults set self.config = deluge.configmanager.ConfigManager( "gtkui.conf", DEFAULT_PREFS) # We need to check on exit if it was started in classic mode to ensure we # shutdown the daemon. self.started_in_classic = self.config["classic_mode"] # Start the IPC Interface before anything else.. Just in case we are # already running. self.queuedtorrents = QueuedTorrents() self.ipcinterface = IPCInterface(args) # Initialize gdk threading Gdk.threads_init() GObject.threads_init() # We make sure that the UI components start once we get a core URI client.set_disconnect_callback(self.__on_disconnect) self.trackericons = TrackerIcons() self.sessionproxy = SessionProxy() # Initialize various components of the gtkui self.mainwindow = MainWindow() self.menubar = MenuBar() self.toolbar = ToolBar() self.torrentview = TorrentView() self.torrentdetails = TorrentDetails() self.sidebar = SideBar() self.filtertreeview = FilterTreeView() self.preferences = Preferences() self.systemtray = SystemTray() self.statusbar = StatusBar() self.addtorrentdialog = AddTorrentDialog() if deluge.common.osx_check() and Gdk.WINDOWING == "quartz": def nsapp_open_file(osxapp, filename): # Will be raised at app launch (python opening main script) if filename.endswith('Deluge-bin'): return True from deluge.ui.gtkui.ipcinterface import process_args process_args([filename]) self.osxapp.connect("NSApplicationOpenFile", nsapp_open_file) from menubar_osx import menubar_osx menubar_osx(self, self.osxapp) self.osxapp.ready() # Initalize the plugins self.plugins = PluginManager() # Show the connection manager self.connectionmanager = ConnectionManager() from twisted.internet.task import LoopingCall rpc_stats = LoopingCall(self.print_rpc_stats) rpc_stats.start(10) reactor.callWhenRunning(self._on_reactor_start) # Start the gtk main loop Gdk.threads_enter() reactor.run() self.shutdown() Gdk.threads_leave()
from app import app from sidebar import SideBar from table import PersonalTable from barchart import BarChart import dash_bootstrap_components as dbc app.layout = dbc.Row( [ dbc.Col([SideBar()], width=3, className="bg-dark"), # slider dbc.Col([BarChart(), PersonalTable()], width=9), # content ], className="vh-100") if __name__ == "__main__": app.run_server(debug=True)
class GtkUI(object): def __init__(self, args): self.daemon_bps = (0, 0, 0) # Setup signals try: import gnome.ui import gnome self.gnome_prog = gnome.init("Deluge", deluge.common.get_version()) self.gnome_client = gnome.ui.master_client() def on_die(*args): reactor.stop() self.gnome_client.connect("die", on_die) log.debug("GNOME session 'die' handler registered!") except Exception, e: log.warning( "Unable to register a 'die' handler with the GNOME session manager: %s", e) if deluge.common.windows_check(): from win32api import SetConsoleCtrlHandler from win32con import CTRL_CLOSE_EVENT from win32con import CTRL_SHUTDOWN_EVENT def win_handler(ctrl_type): log.debug("ctrl_type: %s", ctrl_type) if ctrl_type in (CTRL_CLOSE_EVENT, CTRL_SHUTDOWN_EVENT): reactor.stop() return 1 SetConsoleCtrlHandler(win_handler) # Attempt to register a magnet URI handler with gconf, but do not overwrite # if already set by another program. common.associate_magnet_links(False) # Make sure gtkui.conf has at least the defaults set self.config = deluge.configmanager.ConfigManager( "gtkui.conf", DEFAULT_PREFS) # We need to check on exit if it was started in classic mode to ensure we # shutdown the daemon. self.started_in_classic = self.config["classic_mode"] # Start the IPC Interface before anything else.. Just in case we are # already running. self.queuedtorrents = QueuedTorrents() self.ipcinterface = IPCInterface(args) # Initialize gdk threading gtk.gdk.threads_init() # We make sure that the UI components start once we get a core URI client.set_disconnect_callback(self.__on_disconnect) self.trackericons = TrackerIcons() self.sessionproxy = SessionProxy() # Initialize various components of the gtkui self.mainwindow = MainWindow() self.menubar = MenuBar() self.toolbar = ToolBar() self.torrentview = TorrentView() self.torrentdetails = TorrentDetails() self.sidebar = SideBar() self.filtertreeview = FilterTreeView() self.preferences = Preferences() self.systemtray = SystemTray() self.statusbar = StatusBar() self.addtorrentdialog = AddTorrentDialog() # Initalize the plugins self.plugins = PluginManager() # Late import because of setting up translations from connectionmanager import ConnectionManager # Show the connection manager self.connectionmanager = ConnectionManager() from twisted.internet.task import LoopingCall rpc_stats = LoopingCall(self.print_rpc_stats) rpc_stats.start(10) reactor.callWhenRunning(self._on_reactor_start) # Initialize gdk threading gtk.gdk.threads_enter() reactor.run() self.shutdown() gtk.gdk.threads_leave()
import streamlit as st from PIL import Image from vqa.vqa import VQA import torch from vqa.visualisations.vis import show_architecture from vqa.visualisations.vis import hbarplot import pandas as pd from slit.bb import BoundingBox from slit.attmaps import TextSelfAttMaps import numpy as np from sidebar import SideBar st.title('AMA: Visualizing attentions for Visual Question Answering') sb = SideBar() model_name = sb.model_name question = sb.question image_idx = sb.image_idx st.markdown("### Model Architecture") show_architecture(model_name) # Load the VQA model just after UI is loaded if (model_name is not None): vqa_object = VQA(model_name) image = None image_feat = None bboxes = None if (image_idx is not None):
def build_ui(self): """ builds the user interface """ self.root = root = tk.Tk(className=self.settings.name.lower() ) # --> StartupWMClass = pwcode root.protocol("WM_DELETE_WINDOW", self.quit_app) # img = tk.Image('photo', file=self.icon_file) # TODO: Denne virker med tk8.6 men ikke tk8.5 # img = tk.PhotoImage(self.icon_file) root.tk.call('wm', 'iconphoto', root._w, tk.PhotoImage(file=self.icon_file)) # root.tk.call('wm','iconphoto',root._w,img) # root.iconphoto(False, img) w = 1300 # width for the Tk root h = 800 # height for the Tk root ws = root.winfo_screenwidth() hs = root.winfo_screenheight() x = (ws / 2) - (w / 2) y = (hs / 2) - (h / 2) root.geometry('%dx%d+%d+%d' % (w, h, x, y)) # root.option_add( "*font", "gothic" ) # root.option_add("*Font", "Times 20 bold") # def_font = tk.font.nametofont("TkDefaultFont") # def_font.config(size=16) self.font = tk.font.nametofont("TkDefaultFont") self.font.config( size=10 ) # WAIT: Gjør denne konfigurerbar. Også brukes av editor, eller fortsatt separat? style = theme.build_style(self.settings.colors) root.configure(bg=self.settings.colors.bg) # Avoid flashes of gray # TODO: Må endre tilsvarende på et par andre default farger (eks bakgrunn scrollbar når bytter tab) style.theme_use("pwcode") self.commander = Commander(self) # WAIT: Lag funksjon som leser ut dette auto fra commands.py root.bind("<Alt-x>", lambda x: self.run_command('show_commands')) root.bind("<Control-q>", lambda x: self.run_command('quit_app')) root.bind("<Control-o>", lambda x: self.run_command('open_file')) root.bind("<Control-O>", lambda x: self.run_command('open_folder')) root.bind("<Control-n>", lambda x: self.run_command('new_file')) root.bind("<Control-w>", lambda x: self.run_command('close_file')) root.bind("<Control-s>", lambda x: self.run_command('save_file')) root.bind("<Control-S>", lambda x: self.run_command('save_file_as')) root.bind("<Control-Tab>", self.perform_ctrl_tab, True) root.bind("<Control-Right>", lambda x: self.run_command('next_tab_in_index')) # TODO: Linje under gir FM kun på windows: _tkinter.TclError: bad event type or keysym "KP_Right" #root.bind("<Control-KP_Right>", lambda x: self.run_command('next_tab_in_index')) # on keypad root.bind("<Control-KP_6>", lambda x: self.run_command( 'next_tab_in_index')) # on keypad with num lock root.bind("<Control-Left>", lambda x: self.run_command('previous_tab_in_index')) # TODO: Linje under gir FM kun på windows: _tkinter.TclError: bad event type or keysym "KP_Left" #root.bind("<Control-KP_Left>", lambda x: self.run_command('previous_in_index')) # on keypad root.bind("<Control-KP_4>", lambda x: self.run_command( 'previous_tab_in_index')) # on keypad with num lock root.bind("<Control-plus>", lambda x: self.run_command('increase_text_font')) root.bind("<Control-minus>", lambda x: self.run_command('decrease_text_font')) root.bind("<Control-Return>", self.perform_ctrl_return, True) root.bind_class("Text", "<Control-Return>", lambda e: None) root.bind_class("Text", "<Control-k>", lambda e: None) root.bind("<Control-k>", lambda x: self.run_command('kill_process')) root.bind_class("Text", "<Alt-c>", lambda e: None) root.bind_class("Text", "<Alt_L><c>", lambda e: None) root.bind("<Alt-c>", lambda x: self.run_command('toggle_comment')) root.bind("<Alt_L><c>", lambda x: self.run_command('toggle_comment') ) # WAIT: Denne varianten for Alt-x også? # horizontal layout for the sidebar to expand / collapse panels self.paned = paned = tk.ttk.PanedWindow(root, orient=tk.HORIZONTAL) paned.pack(fill=tk.BOTH, expand=1) self.sidebar = SideBar(paned, self) paned.add(self.sidebar) self.editor_frame = EditorFrame(paned, self) paned.add(self.editor_frame) initial_status = '' self.statusbar = StatusBar(root, self, initial_status) self.statusbar.pack(fill=tk.X, side=tk.BOTTOM)