当前位置: 首页>>代码示例>>Python>>正文


Python view.View类代码示例

本文整理汇总了Python中view.View的典型用法代码示例。如果您正苦于以下问题:Python View类的具体用法?Python View怎么用?Python View使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了View类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, topoWidget):
        View.__init__(self, topoWidget, "FlowTracer")    

        # Buttons
        infoBtn = QtGui.QPushButton('What is FlowTracer?')
        self.connect(infoBtn, QtCore.SIGNAL('clicked()'), self.showInfo)
        traceBtn = QtGui.QPushButton('Trace!')
        self.connect(traceBtn, QtCore.SIGNAL('clicked()'), self.trace_flow)
        self.buttons.append(infoBtn)
        self.buttons.append(traceBtn)
        
        # Signals
        self.topologyInterface.flowtracer_received_signal.connect( \
            self.got_json_msg )
        
        # Subscribe to messages from backend 
        msg = {}
        msg["_mux"] = "gui"
        msg["type"] = "flowtracer"
        msg["command"] = "subscribe"
        msg["msg_type"] = "highlight"
        self.topologyInterface.send( msg ) 
        
        self.highlighted_path = []
        self.querynode = None
开发者ID:09beeihaq,项目名称:pox,代码行数:25,代码来源:flowtracer.py

示例2: saveState

 def saveState(self):
     '''
     Saves the view's settings to configuration.
     '''
     View.saveState(self)
     config.set(self.NAME, self._CONFIG_SECTION_CONSOLE,
                "visible", self._widgetConsole.isVisible())
开发者ID:mlyko,项目名称:tadek-ui,代码行数:7,代码来源:resultview.py

示例3: __init__

class Mission:
    def __init__(self, description, actions, level):
        self.description = description
        self.actions = actions
        self.level = level
        self.view = View()

    def start(self, player):
        self.player = player
        self.view.mission_description(self.description)
       
        decision = self.view.input_mission_decision(self.actions)
        
        passed_mission = self.determine_outcome(decision)
        if passed_mission:
            battle = Battle(self.player, self.level)
            while battle.take_turn():
                pass
            if battle.lost == False:
                return True
        return False

    #TODO make random decision
    def determine_outcome(self, action):
        if action not in self.actions:
            return None
        elif action == self.actions[0]:
            return True
        else:
            return False
开发者ID:hrgunn,项目名称:MLH,代码行数:30,代码来源:controller.py

示例4: Application

class Application(QApplication):
    '''
    The main application class where the main objects
    are set up and connected with each other.
    '''

    def __init__(self, *args):

        QApplication.__init__(self, *args)

        # initialize logging
        logging.basicConfig(filename='log.txt', level=logging.INFO,
                            filemode='w',format='%(asctime)s %(message)s')
        logging.info("Starting application.")

        # initialize user preferences
        preferences = Preferences()

        # initialize model
        market = GoxMarket(preferences)

        # initialize view
        self.view = View(preferences, market)

        self.connect(self, SIGNAL('lastWindowClosed()'), self.__quit)

    def __quit(self):
        self.view.stop()
开发者ID:genbtc,项目名称:goxgui,代码行数:28,代码来源:application.py

示例5: __init__

    def __init__(self, element, composition, timeline):
        goocanvas.Group.__init__(self)
        View.__init__(self)
        Zoomable.__init__(self)

        self.element = element
        self.comp = composition
        self.timeline = timeline

        self.bg = goocanvas.Rect(
            height=self.__HEIGHT__, 
            fill_color_rgba=self.__NORMAL__,
            line_width=0)

        self.content = Preview(self.element)
        self.name = goocanvas.Text(
            x=10,
            text=os.path.basename(unquote(element.factory.name)),
            font="Sans 9",
            fill_color_rgba=0x000000FF,
            alignment=pango.ALIGN_LEFT)
 
        self.start_handle = StartHandle(element, timeline,
            height=self.__HEIGHT__)
        self.end_handle = EndHandle(element, timeline,
            height=self.__HEIGHT__)

        for thing in (self.bg, self.content, self.start_handle, self.end_handle, self.name):
            self.add_child(thing)

        if element:
            self.zoomChanged()
        self.normal()
开发者ID:emdash,项目名称:gst-editor,代码行数:33,代码来源:timelineobject.py

示例6: __init__

    def __init__(self, topoWidget):
        View.__init__(self, topoWidget, "Monitoring")
        
        # Monitoring view buttons
        infoBtn = QtGui.QPushButton('What is Monitoring?')
        
        self.connect(infoBtn, QtCore.SIGNAL('clicked()'), self.showInfo)
       
        self.buttons.append(infoBtn)

        for b in self.buttons:
            b.setCheckable(True)
        
        # maps tuples (dpid, port) to utilization
        self.stats = {}  
        
        self.topologyInterface.monitoring_received_signal.connect( \
            self.got_monitoring_msg )
            
        # Subscribe for linkutils
        msg = {}
        msg["_mux"] = "gui"
        msg ["type"] = "monitoring"
        msg ["command"] = "subscribe"
        msg ["msg_type"] = "linkutils"
        self.topologyInterface.send( msg )    
开发者ID:09beeihaq,项目名称:pox,代码行数:26,代码来源:monitoring.py

示例7: __init__

    def __init__(self, topoWidget):
        View.__init__(self, topoWidget, "Elastic Tree")    

        self.logDisplay = self.topoWidget.parent.logWidget.logDisplay
        utilBtn = QtGui.QPushButton('Change Util Bound')
        infoBtn = QtGui.QPushButton('What is ElasticTree?')

        self.connect(utilBtn, QtCore.SIGNAL('clicked()'),
                    self.changeUtil)
        self.connect(infoBtn, QtCore.SIGNAL('clicked()'), self.showInfo)
#        self.connect(powerBtn, QtCore.SIGNAL('clicked()'),
#                    self.showPowerStats)
#        self.buttons.append(powerBtn)
        self.buttons.append(utilBtn)
        self.buttons.append(infoBtn)
        self.utilBound = 0.01

        self.slider = QtGui.QSlider(QtCore.Qt.Horizontal, self)
        self.slider.setMinimum(0)
        self.slider.setMaximum(100)
        self.buttons.append(self.slider)
        self.sliderValue = 0
        self.stats = {}  # maps tuples (dpid, port) to utilization

        self.powerSliderSignal.connect(self.changeSlider)
        
        self.indicator = QtGui.QLabel()
        self.buttons.append(self.indicator)
开发者ID:09beeihaq,项目名称:pox,代码行数:28,代码来源:elastictree.py

示例8: Infrastructure

class Infrastructure():
    def __init__(self, resolution, frame_rate):
        self.frame_rate = frame_rate
        self.event_manager = EventManager()
        self.event_manager.register_listener(self)
        self.model = Model(self.event_manager)
        self.view = View(self.event_manager, resolution)
        self.controller = InputController(self.event_manager)
        self.main_loop = True

    def update_resolution(self, resolution):
        self.view.update_window(resolution)

    def update_frame_rate(self, frame_rate):
        self.frame_rate = frame_rate

    def run_main(self):
        while self.main_loop:
            clock = pygame.time.Clock()
            milliseconds = clock.tick(self.frame_rate)
            self.event_manager.post(TickEvent(milliseconds))

    def get_event_manager(self):
        return self.event_manager

    def notify(self, event):
        if isinstance(event, QuitEvent):
            self.main_loop = False
开发者ID:TheSuiteLife,项目名称:Aspirin,代码行数:28,代码来源:infrastructure.py

示例9: __init__

class Controller:
    # Constructor
    def __init__(self, root):
        # Retrieve my model (or create)
        self.my_number = Model()
        self.my_number.add_callback(self.number_change)

        # Create the view
        self.view_number = View(root)

        # Link View elements to Controller
        self.view_number.inc_button.config(command=self.inc_number)
        self.view_number.dec_button.config(command=self.dec_number)

        self.number_change(self.my_number.get())

    # Action to Model from View elements
    def inc_number(self):
        self.my_number.set(self.my_number.get() + 1)

    def dec_number(self):
        self.my_number.set(self.my_number.get() - 1)

    # Update View from Model
    def number_change(self, n):
        self.view_number.update_number(n)
开发者ID:johndspence,项目名称:holbertonschool-higher_level_programming,代码行数:26,代码来源:controller.py

示例10: __init__

    def __init__(self, app):
        View.__init__(self, app)
        self.app_window.feedview.listbox.connect('row-activated', self.show_entries)
        self.app_window.feedhandler.connect("feed-updated", self.update_entryview)

        self.listbox = Gtk.ListBox()
        self.add(self.listbox)
开发者ID:nanamii,项目名称:gylfeed,代码行数:7,代码来源:entrylistview.py

示例11: Application

class Application(QApplication):
    '''
    The main application class where the main objects
    are set up and connected with each other.
    '''

    def __init__(self, *args):

        self.logfile = open('log.txt', 'w')

        QApplication.__init__(self, *args)

        # initialize model (gox)
        #goxapi.FORCE_PROTOCOL = 'socketio'
        self.config = goxapi.GoxConfig("goxtool.ini")
        self.secret = goxapi.Secret(self.config)
        self.gox = goxapi.Gox(self.secret, self.config)

        
        self.strategy_object = stoploss.Strategy(self.gox)
                
        # initialize view
        self.view = View(self.gox, self.secret, self.logfile)
        self.view.log('Starting application.')

        # start connection to MtGox
        self.gox.start()
        
        self.connect(self, SIGNAL('lastWindowClosed()'), self.__quit)

    def __quit(self):
        self.gox.stop()
        self.logfile.close()
开发者ID:twhyte,项目名称:goxgui,代码行数:33,代码来源:application.py

示例12: tick

    def tick(self):
        reported = set()
        while self.views_changed:
            v, buf = self.views_changed.pop()
            if not self.joined_workspace:
                msg.debug('Not connected. Discarding view change.')
                continue
            if 'patch' not in G.PERMS:
                continue
            if 'buf' not in buf:
                msg.debug('No data for buf ', buf['id'], ' ', buf['path'], ' yet. Skipping sending patch')
                continue
            view = View(v, buf)
            if view.is_loading():
                msg.debug('View for buf ', buf['id'], ' is not ready. Ignoring change event')
                continue
            if view.native_id in reported:
                continue
            reported.add(view.native_id)
            patch = utils.FlooPatch(view.get_text(), buf)
            # Update the current copy of the buffer
            buf['buf'] = patch.current
            buf['md5'] = patch.md5_after
            self.send(patch.to_json())

        reported = set()

        self._status_timeout += 1
        if self._status_timeout > (2000 / G.TICK_TIME):
            self.update_status_msg()
开发者ID:cc7768,项目名称:secret-computing-machine,代码行数:30,代码来源:sublime_connection.py

示例13: main

def main():
    if password_changed():
        config = Configuration()
        indexView=View(config.system.actions)
        indexView.output()
    else:
        redirect()
开发者ID:cernvm,项目名称:cernvm-appliance-agent,代码行数:7,代码来源:index.py

示例14: __init__

class Controller:
    def __init__(self):
        self.view = View()
        self.serialize = Serialize()

    def menu(self):
        while True:
            point = self.view.create_menu()
            if point == 1:
                self._calculate()
            elif point == 2:
                self.serialize.load()
            elif point == 3:
                data = self.view.change_serialization_file()
                self.serialize.change_config(data[0], data[1])
            elif point == 4:
                break

    def _calculate(self):
        gender = self.view.read_gender()
        weight = self.view.read_weight()
        height = self.view.read_height()
        age = self.view.read_age()
        pa = self.view.read_pa()
        model = Model(gender, weight, height, age, pa)
        self.view.get_info(model.get_info())
        data = (gender, weight, height, age, pa, model.calculate_calories())
        input()
        if self.view.is_dump():
            self.serialize.dump(data)
开发者ID:LonelyDragon,项目名称:Architecture,代码行数:30,代码来源:controller.py

示例15: view

 def view(self, header_names, lines, vertical_header=None, initial_sort=[], decimal_points=3):
   sub_views = []
   conv_lines = []
   # turn lines to html
   for line in lines:
     conv_line, sub_sub_views = convert_to_html(line)
     conv_lines.append(conv_line)
     sub_views += sub_sub_views
     
   conv_sort = []
   for s in initial_sort:
     dir = 0
     if s[1] == 'asc':
       dir = 0
     elif s[1] == 'desc':
       dir = 1
     else:
       raise Exception('Sort must either be asc or desc')
     conv_sort.append('[%d,%d]' % (header_names.index(s[0]), dir))
   conv_sort = ', '.join(conv_sort)
   conv_sort = '[%s]' % conv_sort
   data = OrderedDict()
   for i in xrange(len(header_names)):
     data[header_names[i]] = [l[i] for l in conv_lines]
   html = render('table.html', {
       'vertical_header' : vertical_header,
       'data' : data,
       'id' : self._get_unique_id(),
       'header_names': header_names,
       'lines': conv_lines,
       'sort': conv_sort})
   v = View(self, html, ['table.css'], ['jquery.tablesorter.js'])
   for sub in sub_views:
     v.append_view_files(sub)
   return v
开发者ID:ericjsolis,项目名称:danapeerlab,代码行数:35,代码来源:table.py


注:本文中的view.View类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。