def __init__(self):
        super(Tools, self).__init__()

        vboxIndex = gtk.VBox(False, 5)
        aIndex = gtk.Alignment(0.5, 0.25, 0, 0)
        aIndex.add(Index())

        vboxAlign = gtk.VBox(False, 5)
        aAlign = gtk.Alignment(0.5, 0.25, 0, 0)
        aAlign.add(Alignment())

        #Viewer notebook
        vboxViewer = gtk.VBox(False, 5)
        aViewer = gtk.Alignment(0.5, 0.25, 0, 0)
        aViewer.add(Viewer())

        vboxIndex.pack_start(aIndex)
        vboxAlign.pack_start(aAlign)
        vboxViewer.pack_start(aViewer)

        self.set_tab_pos(gtk.POS_TOP)
        self.append_page(vboxIndex)
        self.set_tab_label_text(vboxIndex, config.LOC["tools_index"])
        self.append_page(vboxAlign)
        self.set_tab_label_text(vboxAlign, config.LOC["tools_align"])
        self.append_page(vboxViewer)
        self.set_tab_label_text(vboxViewer, config.LOC["tools_viewer"])
Example #2
0
    def __init__(self, table, parentviewer, attrs):
        AttrElem.__init__(self, attrs)
        self._table = table
        self._container = table.container

##      from profile import Profile
##      from pstats import Stats
##      p = Profile()
##      # can't use runcall because that doesn't return the results
##      p.runctx('self._viewer = Viewer(master=table.container, context=parentviewer.context, scrolling=0, stylesheet=parentviewer.stylesheet, parent=parentviewer)',
##               globals(), locals())
##      Stats(p).strip_dirs().sort_stats('time').print_stats(5)

        self._viewer = Viewer(master=table.container,
                              context=parentviewer.context,
                              scrolling=0,
                              stylesheet=parentviewer.stylesheet,
                              parent=parentviewer)
        if not parentviewer.find_parentviewer():
            self._viewer.RULE_WIDTH_MAGIC = self._viewer.RULE_WIDTH_MAGIC - 6
        # for callback notification
        self._fw = self._viewer.frame
        self._tw = self._viewer.text
        self._tw.config(highlightthickness=0)
        self._width = 0
        self._embedheight = 0
Example #3
0
def view_grade_report(assignment_dir: str) -> None:
    print('Choose a report to view')
    report = gfs.get_file('Choose Assignment Report Zip', 'Zip Files (*.zip)',
                          join(assignment_dir, 'results'))
    if report == '':
        return None

    viewer = Viewer(join(assignment_dir, 'results'), report)
    UI.start_ui(viewer)
Example #4
0
    def __init__(self):
        self.width = 16
        self.height = 9
        self._cell_size = 10

        self.action_space = spaces.Discrete(4)
        self.observation_space = spaces.Box(self.height * self._cell_size, self.width * self._cell_size, 1)

        self.viewer = Viewer(width=self.width, height=self.height, cell_size=self._cell_size)

        self._seed()
        self.reset()
Example #5
0
    def __init__(self, get_session, get_chat):
        Gtk.Window.__init__(self, title="emesene log viewer")
        self.get_session = get_session
        self.get_chat = get_chat
        self.connect("delete-event", Gtk.main_quit)
        self.resize(300,500)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.hpaned = Gtk.HPaned()
        view = Viewer()
        self.scroll_view = Gtk.ScrolledWindow()
        self.scroll_view.set_border_width(1)
        self.scroll_view.add(view)
        img_remove = Gtk.Image()
        img_remove.set_from_stock(Gtk.STOCK_CLOSE, Gtk.IconSize.MENU)
        self.b_remove = Gtk.Button()
        self.b_remove.set_image(img_remove)
        self.b_alig = Gtk.Alignment(xalign=1, yalign=1, xscale=0.0, yscale=1.0)
        self.b_alig.add(self.b_remove)
        self.b_remove.connect('clicked', self._clicked) 
        self.view_box = Gtk.VBox(False,1)
        self.view_box.set_border_width(8)
        self.view_box.pack_start(self.b_alig, False, False, 1)
        self.view_box.pack_start(self.scroll_view, True, True, 1)

        contacts = ContactList(view.load_contact_log, self.get_chat, self.hpaned, self.view_box, self.resize)
        mb = MenuBar(self.get_session, contacts.fill_contact_list, 
            self.show_widget, self.unload, self._about)

        self.login = Login(self.get_session, contacts.fill_contact_list,
            self.show_widget, self.unload, mb.filemenu, mb.unload_item)

        scroll_contact = Gtk.ScrolledWindow()

        scroll_contact.set_border_width(1)
 
        scroll_contact.add(contacts)
        self.hpaned.add1(scroll_contact)
        self.hpaned.set_position(250)
        self.vbox = Gtk.VBox(False, 7)

        self.vbox.pack_start(mb, False, False, 1)
        self.vbox.pack_start(self.login, False, False, 10)
        self.add(self.vbox)
        self.show_all()
Example #6
0
 def __init__(self, json_dict, images_folder, window_width, window_height):
     super(Visualizer, self).__init__()
     self.threshold_selector = ThresholdSelector(show_delay=True)
     self.image_selector = ImageSelector(
         json_dict,
         images_folder,
         self.threshold_selector.get_current_threshold(),
         show_delay=True)
     self.viewer = Viewer(window_width, window_height)
     self.painter = Painter(json_dict, images_folder,
                            self.image_selector.get_current_image_idx(),
                            self.threshold_selector.get_current_threshold())
     self.image_selector.imageChanged.connect(self.painter.new_image)
     self.threshold_selector.thresholdChanged.connect(
         self.image_selector.new_threshold)
     self.threshold_selector.thresholdChanged.connect(
         self.painter.new_threshold)
     self.painter.boxesDrawn.connect(self.viewer.set_scene)
     self.init_UI()
     self.painter.draw(reset_scale=True)
Example #7
0
 def run(self):
     if self.simulation_state.show_viewer:
         self.viewer = Viewer(self.simulation_state, self.aircraft_state,
                              self.app)
     if self.simulation_state.show_plotter:
         self.plotter = Plotter(self.log, self.app)
     self.sim_loop()
     self.export_logs()
     if not self.simulation_state.show_plotter and self.simulation_state.aar:
         self.plotter = Plotter(self.log, self.app)
         self.plotter.update_plots()
         self.app.processEvents()
         print("Opening After Action Report")
     if self.simulation_state.show_viewer or self.simulation_state.show_plotter or self.simulation_state.aar:
         input("Press enter to quit.")
         if self.simulation_state.show_viewer:
             self.viewer.window.close()
         if self.simulation_state.show_plotter or self.simulation_state.aar:
             self.plotter.window.close()
         self.app.quit()
Example #8
0
 def create_widgets(self, width, height, geometry):
     # I'd like to be able to set the widget name here, but I'm not
     # sure what the correct thing to do is.  Setting it to `grail'
     # is definitely *not* the right thing to do since this causes
     # all sorts of problems.
     self.root = tktools.make_toplevel(self.master, class_='Grail')
     self._window_title("Grail: New Browser")
     if geometry:
         self.root.geometry(geometry)
     self.root.protocol("WM_DELETE_WINDOW", self.on_delete)
     self.topframe = Frame(self.root)
     self.topframe.pack(fill=X)
     self.create_logo()
     self.create_menubar()
     self.create_urlbar()
     self.create_statusbar()
     self.viewer = Viewer(self.root, browser=self,
                          width=width, height=height)
     self.context = self.viewer.context
     if self.app.prefs.GetBoolean('browser', 'show-logo'):
         self.logo_init()
Example #9
0
def main():
    rmc = Viewer()
    arg = None
    isfile = True
    if len(argv) > 1:
        arg = abspath(argv[1])
        if not exists(arg):
            arg = None
        elif isdir(arg):
            isfile = False
            dngs = [f for f in listdir(arg) if f.lower().endswith(".dng")]
            if len(dngs) > 0:
                isfile = True
    if arg and isfile:
        rmc.load(abspath(arg))
    else:
        rmc.openBrowser(arg)

    ret = rmc.run()
    PerformanceLog.PLOG_PRINT()

    return ret
 def __init__(self, vnum=0, vnum2=1):
     Thread.__init__(self)
     self.vs = None
     self.vs2 = None
     self.view = Viewer()
     #self.distance = DistanceDetect()
     #self.distance.callibrationFromCamera()
     self.text = TextDetect('eng')
     self.data = videomodule_t()
     classes = [
         "background", "aeroplane", "bicycle", "bird", "boat", "bottle",
         "bus", "car", "cat", "chair", "cow", "diningtable", "dog", "horse",
         "motorbike", "person", "pottedplant", "sheep", "sofa", "train",
         "tvmonitor"
     ]
     self.view.setClasses(classes)
     self.view.setNet(
         "C:\\BPHS_python_prototype-\\MobileNetSSD_deploy.prototxt.txt",
         "C:\\BPHS_python_prototype-\\MobileNetSSD_deploy.caffemodel")
     self.running = True
     self.operation_type = 'ObjectDetection'
     self.videonum = vnum
     self.videonum2 = vnum2
Example #11
0
    def initUI(self):
        # Widget of CodeBlocks
        wgCodeBlocks = QWidget()

        saCodeBlocks = QScrollArea()
        saCodeBlocks.setWidget(wgCodeBlocks)
        saCodeBlocks.setWidgetResizable(True)
        saCodeBlocks.setAlignment(Qt.AlignTop)

        self.vblCodeBlocks = QVBoxLayout()
        self.vblCodeBlocks.setAlignment(Qt.AlignTop)
        wgCodeBlocks.setLayout(self.vblCodeBlocks)
        self.newCodeBlock()

        # Widget of FileControl
        self.fileControl = FileControl(self)

        # Widget of BlockControl
        self.blockControl = BlockControl(self)

        # Widget of Viewer
        self.viewer = Viewer()

        # Layout of Editor
        glEditor = QGridLayout()
        glEditor.addWidget(saCodeBlocks, 0, 0, 10, 1)
        glEditor.addWidget(self.fileControl, 0, 1, 1, 1)
        glEditor.addWidget(self.blockControl, 1, 1, 1, 1)
        glEditor.addWidget(self.viewer, 2, 1)

        # Widget of Editor
        wgEditor = QWidget()
        wgEditor.setLayout(glEditor)
        self.setCentralWidget(wgEditor)
        self.mousePressEvent(None)
        self.showMaximized()
Example #12
0
 def genMap(self):
     if self.trans:
         Viewer(self, self.trans)
Example #13
0
from Viewer import Viewer
from VideoAnalyzer import VideoAnalyzer
from Constants import *
import time, pygame
import os

os.environ['SDL_VIDEO_CENTERED'] = '1'  # Set the window in the center

vw = Viewer()
va = VideoAnalyzer(vw)

vw.start()
va.start()
Example #14
0
def createViewer(dScaling=0):
    return Viewer(
        {
            'title':
            'NetInstaller',
            'resizable':
            False,
            'widgets': [{
                'type':
                LabelFrame,
                'boder': (1, 'sunken'),
                'fitLayout':
                False,
                'width':
                140,
                'height':
                195,
                'text':
                'Setup',
                'extra': {
                    'ipadx': 1,
                    'ipady': 1,
                    'padx': 5,
                    'pady': 0,
                    'side': 'left'
                },
                'widgets': [{
                    'type':
                    Frame,
                    'extra': {
                        'fill': 'x',
                        'padx': 5,
                        'pady': 3
                    },
                    'widgets': [{
                        'type': Label,
                        'text': 'Endereço do servidor:',
                        'anchor': 'w',
                        'extra': {
                            'fill': 'x'
                        }
                    }, {
                        'id': 'serverUrl',
                        'type': Entry,
                        'text': 'server.stein.lan',
                        'extra': {
                            'fill': 'x'
                        }
                    }]
                }, {
                    'type':
                    Frame,
                    'extra': {
                        'fill': 'x',
                        'padx': 5,
                        'pady': 0
                    },
                    'widgets': [{
                        'type': Label,
                        'text': 'Versões disponíveis:',
                        'anchor': 'w',
                        'extra': {
                            'fill': 'x'
                        }
                    }, {
                        'type':
                        Frame,
                        'widgets': [{
                            'id': 'version-list',
                            'type': Combobox,
                            'width': 20,
                            'readonly': False,
                            'itens': []
                        }, {
                            'id': 'refresh',
                            'type': Button,
                            'text': 'Atualizar',
                            'extra': {
                                'fill': 'x',
                                'pady': 5
                            }
                        }]
                    }]
                }, {
                    'type':
                    Frame,
                    'extra': {
                        'fill': 'x',
                        'padx': 5,
                        'pady': 0
                    },
                    'widgets': [{
                        'type': Label,
                        'text': 'Caminho para instalação:',
                        'anchor': 'w',
                        'extra': {
                            'fill': 'x'
                        }
                    }, {
                        'id': 'install-path',
                        'type': Entry,
                        'readonly': True,
                        'text': '',
                        'extra': {
                            'fill': 'x'
                        }
                    }]
                }, {
                    'type': Frame,
                    'boder': (1, 'sunken'),
                    'fitLayout': False,
                    'extra': {
                        'pady': 5
                    },
                    'width': 140,
                    'height': 2,
                    'widgets': []
                }, {
                    'type': Label,
                    'text': 'Instalação',
                    'extra': {
                        'fill': 'x',
                        'padx': 5
                    },
                }, {
                    'type':
                    Frame,
                    'extra': {
                        'fill': 'x'
                    },
                    'widgets': [{
                        'id': 'letter-list',
                        'type': Combobox,
                        'readonly': False,
                        'width': 3,
                        'itens': [],
                        'extra': {
                            'side': 'left',
                            'padx': 3
                        }
                    }, {
                        'id': 'run',
                        'type': Button,
                        'text': 'Iniciar',
                        'width': 30,
                        'font': ("TkDefaultFont", "12", "bold"),
                        'extra': {
                            'side': 'right',
                            "pady": 3,
                            "padx": 3
                        }
                    }]
                }]
            }, {
                'type':
                LabelFrame,
                'boder': (1, 'sunken'),
                'fitLayout':
                False,
                'width':
                140,
                'height':
                63,
                'text':
                'Status',
                'extra': {
                    'ipadx': 1,
                    'ipady': 1,
                    'padx': 5,
                    'pady': 5
                },
                'widgets': [{
                    'type':
                    Frame,
                    'extra': {
                        'fill': 'x'
                    },
                    'widgets': [{
                        'type': Label,
                        'text': 'Rede:',
                        'anchor': 'w',
                        'extra': {
                            'side': 'left'
                        }
                    }, {
                        'id': 'network-status',
                        'type': Label,
                        'text': 'Não conectado',
                        'font': ("Verdana", "8", "bold"),
                        'anchor': 'w',
                        'extra': {
                            'side': 'left'
                        }
                    }]
                }, {
                    'type':
                    Frame,
                    'extra': {
                        'fill': 'x'
                    },
                    'widgets': [{
                        'type': Label,
                        'text': 'Modo de boot:',
                        'anchor': 'w',
                        'extra': {
                            'side': 'left'
                        }
                    }, {
                        'id': 'boot-mode',
                        'type': Label,
                        'text': 'Desconhecido',
                        'font': ("Verdana", "8", "bold"),
                        'anchor': 'w',
                        'extra': {
                            'side': 'left'
                        }
                    }]
                }, {
                    'type':
                    Frame,
                    'extra': {
                        'fill': 'x'
                    },
                    'widgets': [{
                        'type': Label,
                        'text': 'Arquitetura:',
                        'anchor': 'w',
                        'extra': {
                            'side': 'left'
                        }
                    }, {
                        'id': 'arch',
                        'type': Label,
                        'text': 'Desconhecido',
                        'font': ("Verdana", "8", "bold"),
                        'anchor': 'w',
                        'extra': {
                            'side': 'left'
                        }
                    }]
                }]
            }, {
                'type':
                LabelFrame,
                'boder': (1, 'sunken'),
                'fitLayout':
                False,
                'width':
                140,
                'height':
                90,
                'text':
                'Utilitários',
                'extra': {
                    'ipadx': 1,
                    'ipady': 1,
                    'padx': 5,
                    'pady': 5
                },
                'widgets': [{
                    'id': 'load-driver',
                    'type': Button,
                    'text': 'Carregar Driver',
                    'extra': {
                        'fill': 'x',
                        'padx': 5,
                        'pady': 3
                    }
                }, {
                    'id': 'run-diskpart',
                    'type': Button,
                    'text': 'Diskpart',
                    'extra': {
                        'fill': 'x',
                        'padx': 5,
                        'pady': 3
                    }
                }, {
                    'id': 'run-cmd',
                    'type': Button,
                    'text': 'Prompt de Comando',
                    'extra': {
                        'fill': 'x',
                        'padx': 5,
                        'pady': 3
                    }
                }]
            }, {
                'type':
                Frame,
                'fitLayout':
                False,
                'width':
                140,
                'height':
                20,
                'extra': {
                    'ipadx': 1,
                    'ipady': 1,
                    'padx': 5,
                    'pady': 10
                },
                'widgets': [{
                    'type': Label,
                    'text': 'Edwino Stein - 2018 - v2.1.0d',
                    'anchor': 'center'
                }]
            }]
        }, dScaling)
        if self.is_within_bounds(x, y):
            image[x][y] = self.dict['color_func'](x, y)

    def kill_cell(self, image, x, y):
        """
        Kills the specified cell 
        :param image: a reference to a cell grid to modify
        :params x, y: x and y coordinates of the living cell in the provided cell grid
        """
        if self.is_within_bounds(x, y):
            image[x][y] = 0


def color_function(x, y):
    """
    This is a fork of my original automata project, and color should be left 255 (white).
    """
    #setting a return of 255 defaults automaton to simple black and white (dead and alive)
    return 255


#Create a new Automaton Object
new_automaton = Automaton(200, 200, color_function)

#There are three methods to choose from for generating an initial state:
new_automaton.initialize_with_noise(12)

#Initializes the pygame viewer object and starts
viewer = Viewer(new_automaton.update, (900, 900))
viewer.start()
Example #16
0
 def set_grid_size(self, width, height):
     self.width = width
     self.height = height
     self.viewer = Viewer(height=self.height, width=self.width, cell_size=self._cell_size)
     self.reset()