コード例 #1
0
 def closeview(self, sender):
     # Close textview or webview subviews
     sender.superview.superview.remove_subview(sender.superview)
     # Reload sceneview subview
     self.scene_view = scene.SceneView(frame=self.bounds)
     self.scene_view.scene = MyScene()
     self.add_subview(self.scene_view)
コード例 #2
0
 def __init__(self):
     ui.View.__init__(self)
     self.scene_view = scene.SceneView()
     self.scene_view.scene = MainMenuScene()
     self.present(hide_title_bar=True)
     self.scene_view.frame = self.bounds
     self.add_subview(self.scene_view)
コード例 #3
0
	def __init__(self,scn,*args,**kwargs):
		ui.View.__init__(self,*args,**kwargs)
		self.sv=scene.SceneView()
		self.sv.scene=scn
		self.scene=scn
		self.scene.error=False
		self.add_subview(self.sv)
コード例 #4
0
ファイル: timerview.py プロジェクト: cclauss/Pythonista-4
 def create_sceneview(self):
     scene_view = scene.SceneView()
     scene_view.width = 0
     scene_view.height = 0
     scene_view.frame_interval = self.frame_interval
     scene_view.scene = TimerView.TimerScene()
     return scene_view
コード例 #5
0
 def __init__(self, in_scene):
     # Set up title bar with web view button
     b = ui.ButtonItem('View on the Web', action=self.web_weather)
     self.right_button_items = [b]
     self.present('full_screen')
     self.scene_view = scene.SceneView(frame=self.bounds)
     self.scene_view.scene = in_scene
     self.add_subview(self.scene_view)
コード例 #6
0
 def __init__(self, game=None, in_scene=None):
     self.game = game or ChessGame()
     in_scene = in_scene or ChessLoadingScreen
     self.present('full_screen',
                  orientations=['landscape'],
                  hide_title_bar=True)
     self.scene_view = scene.SceneView(frame=self.frame)
     self.scene_view.scene = in_scene()
     self.add_subview(self.scene_view)
     self.add_subview(self.close_button())
     self.switch_scene()  # switch from loading to main
コード例 #7
0
 def __init__(self, in_scene):
   # Set up title bar with web view button
   b1 = ui.ButtonItem('Web View', action = self.web_weather, tint_color = 'black')
   self.right_button_items = [b1]
   # If any severe weather then set up a button to view the alerts
   if len(wa.get_alerts(json_w, json_f)) != 0:
     b2 = ui.ButtonItem('Severe Weather Alert', action = self.alerts, tint_color = 'red')
     self.left_button_items = [b2]
   self.present('full_screen')
   self.scene_view = scene.SceneView(frame = self.bounds)
   self.scene_view.scene = in_scene
   self.add_subview(self.scene_view)
コード例 #8
0
 def __init__(self):
     self.present('full_screen', hide_title_bar=True)
     x, y = self.center
     rects = {
         'red': (0, 0, x, y),
         'green': (x, 0, x, y),
         'blue': (0, y, x, y),
         'white': (x, y, x, y)
     }
     for color in rects:
         scene_view = scene.SceneView(frame=rects[color])
         scene_view.scene = MyScene(colors[color])
         self.add_subview(scene_view)
     self.add_subview(self.close_button())
コード例 #9
0
 def __init__(self, in_scene):
     # Set up title bar with web view button
     b1 = ui.ButtonItem('Web View',
                        action=self.web_weather,
                        tint_color='black')
     b2 = ui.ButtonItem('Menu', action=self.reload_main, tint_color='green')
     self.right_button_items = [b2, b1]
     self.main_menu()
     try:
         # If any severe weather then set up a button to view the alerts
         if len(wa.get_alerts(json_w, json_f)) != 0:
             b3 = ui.ButtonItem('Severe Weather Alert',
                                action=self.alerts,
                                tint_color='red')
             self.left_button_items = [b3]
         else:
             self.left_button_items = []
     except NameError:
         pass
     self.present('full_screen')
     self.scene_view = scene.SceneView(frame=self.bounds)
     self.scene_view.scene = in_scene
     self.add_subview(self.scene_view)
コード例 #10
0
    def __init__(self):
        self.view = ui.load_view('PhotoTextV2')
        self.set_button_actions()
        self.view.present('full_screen')

        img = photos.pick_image()
        if img:
            console.hud_alert('Please wait...')
            scale = scene.get_screen_scale()
            #print str(scale)
            picsize = scene.Size(*img.size)
            width = picsize[0] / scale
            height = picsize[1] / scale
            self.sv2 = self.view['scrollview2']
            self.sv2.content_size = (width, height)
            self.sv2v1 = self.sv2.subviews[0]  #sv2v1 = view1 in scrollview2
            self.sv2v1.bounds = (0, 0, width, height)
            self.sceneView = scene.SceneView(frame=self.sv2v1.bounds)
            self.sceneView.scene = MyPicture(self.view['scrollview1'].subviews[0].text, img, picsize)
            img = None
            self.sv2.add_subview(self.sceneView)
        else:
            self.view.close()
コード例 #11
0
# https://forum.omz-software.com/topic/3306/disable-on-screen-printing-in-scene-

import scene, ui
from objc_util import UIApplication

def close_view():
	v.close()
	
class MyScene(scene.Scene):
	def setup(self):
		self.test_label = scene.LabelNode('Test hide title bar',
		position=self.size/2.0, parent=self)
		self.close_label = scene.LabelNode('Close view',
		position=(self.size[0]/2, self.size[1]/2-100),
		parent=self)
		
	def touch_began(self, touch):
		if touch.location in self.close_label.frame:
			close_view()
			
w, h = ui.get_window_size()
frame = (0, 0, w, h)
v = ui.View(frame=frame)
scene_view = scene.SceneView(frame=frame)
scene_view.flex= 'WH'
scene_view.scene = MyScene()
v.add_subview(scene_view)
v.present('fullscreen', hide_title_bar=True)
UIApplication.sharedApplication().statusBar().hidden = True

コード例 #12
0
# https://forum.omz-software.com/topic/3306/disable-on-screen-printing-in-scene-sceneview/9

import scene, ui


class MyScene(scene.Scene):
    def setup(self):
        self.label = scene.LabelNode('Test hide title bar',
                                     position=self.size / 2,
                                     parent=self)


#scene.run(MyScene())
'''
# This does not hide the close button
scene_view = scene.SceneView()
scene_view.scene = MyScene()
scene_view.present('fullscreen', hide_title_bar=True)
'''

# This works
v = ui.View()
scene_view = scene.SceneView()
scene_view.flex = 'WH'
scene_view.scene = MyScene()
v.add_subview(scene_view)
v.present('fullscreen', hide_title_bar=True)
コード例 #13
0
ファイル: HIDremClient.py プロジェクト: nowyouare/HIDrem
    def __init__(self):
        # ui setup
        ui.View.__init__(self)
        self.connected = False
        self.proto = None
        self.background_color = "#000000"
        self.cmb = ui.Button()
        self.conb = ui.Button()
        self.sceneholder = scene.SceneView()
        self.AI = ui.ActivityIndicator()
        self.controller = ControllScene(self)
        self.sceneholder.background_color = self.background_color
        self.cmb.image = ui.Image('iob:game_controller_b_256')
        self.conb.image = ui.Image('iob:wifi_256')
        self.add_subview(self.cmb)
        self.add_subview(self.conb)
        self.add_subview(self.sceneholder)
        self.add_subview(self.AI)
        self.cmb.border_width = self.conb.border_width = 2
        self.cmb.border_color = self.conb.border_color = '#ff0000'
        self.cmb.tint_color = self.conb.tint_color = "#ff0000"
        self.cmb.corner_radius = self.conb.corner_radius = 15
        self.cmb.flex = self.conb.flex = "TBHLRW"
        self.sceneholder.flex = "TBHLRW"
        y = self.height / 2.0
        midx = self.width / 2.0
        width = (5.0 / 16.0) * self.width
        offset = (1.0 / 6.0) / 2.0 * self.width
        height = (1.0 / 2.0) * self.height
        y = (self.height - height) / 2.0
        cmbx = midx - offset - width
        conbx = midx + offset
        self.cmb.frame = (cmbx, y, width, height)
        self.conb.frame = (conbx, y, width, height)
        self.sceneholder.frame = (0, self.height - y, self.width, y)
        self.sceneholder.frame_interval = 4
        self.sceneholder.anti_alias = True
        self.sceneholder.shows_fps = False
        self.sceneholder.scene = self.controller
        self.AI.style = ui.ACTIVITY_INDICATOR_STYLE_WHITE_LARGE
        self.AI.hides_when_stopped = True
        self.AI.frame = (midx - offset, self.height / 2.0 - offset, offset * 2,
                         offset * 2)
        self.AI.flex = "TBHLRW"
        self.controller.show_nconn = True
        self.controller.update_label()

        # conn setup
        self.manager = com.ConnectionManager(debug=DEBUG)

        # other setup
        self.proxy = CCProxy()
        self.proxy.default_receiver = self
        self.cmb.action = self.show_cmb_setup
        self.conb.action = self.show_connection_setup

        self.bthr = threading.Thread(name="Background jobs",
                                     target=self.background_thread)
        self.bthr.daemon = True
        self.bthr.start()

        if not os.path.exists(KEYMAPPATH):
            os.mkdir(KEYMAPPATH)

        try:
            self.keymap = Keymap.load("default")
        except IOError:
            self.keymap = Keymap("default", {})
            self.keymap.save()
コード例 #14
0
sound_title = editor['sound_title']

bubble = editor['bubble']
bubble.image = ui.Image('emj:Hearts')
player = editor['chr_1']
player.image = ui.Image('plf:AlienGreen_stand')
player2 = editor['chr_2']
player2.image = ui.Image('plf:AlienPink_front')
platform = editor['platform']
platform.image = ui.Image('Art/IMG_0066.PNG')
npc = editor['npc']
npc.image = ui.Image('plf:AlienBeige_front')

settings_view = editor['settings_view']
music_switch = settings_view['music_switch']
music_switch.action = toggle_music
pause_switch = settings_view['pause_switch']
pause_switch.action = game.pause_game
console = settings_view['console']
print(player.image.size)
get_objects()

# A Scene View is a ui.View that can display a scene
# A good way to use the scene and ui modules together.
sv = scene.SceneView()
sv.scene = game
sv.shows_fps = True
sv.add_subview(editor)
sv.present()
game.sound_player.play()
コード例 #15
0
		
		# if fire button pressed, create a new missile
		if touch.location in self.fire_button.frame:
			self.create_new_missile()
			
	def create_new_missile(self):
		# when the user hits the fire button
		missle = scene.SpriteNode('spc:Fire1',
		position=self.spaceship.position,
		parent=self)
		missle.run_action(Action.move_to(self.spaceship.position.x,
		self.size.y + 100,
		1.0))
		self.missiles.append(missle)
		
		
#  ..use when deploying app for Xcode and the App Store
if __name__ == '__main__':
	main_view = ui.View()
	scene_view = scene.SceneView(frame=main_view.bounds, flex='WH')
	scene_view.scene = FirstScene()
	main_view.add_subview(scene_view)
	main_view.present(hide_title_bar=True, animated=False)
	
	# scene_view = scene.SceneView()
	# scene_view.scene = FirstScene()
	# scene_view.present(hide_title_bar = True, animated = False)
	
	# scene.run(FirstScene())

コード例 #16
0
 def __init__(self, the_scene):
     scene_view = scene.SceneView()
     scene_view.scene = the_scene
     self.present(hide_title_bar=True)
     scene_view.frame = self.bounds
     self.add_subview(scene_view)
コード例 #17
0
  def main(self):
# actually you need only to preserve those properties that are needed after the main_view.present call, 
# in this case the self.morpher. All the other self. prefixes are not needed for the same functionality
    self.q=queue.PriorityQueue()
    self.q1=queue.PriorityQueue()
    self.Eprom=Eprom1()
    self.sv=scene.SceneView()
    self.sv.scene=MyScene()
    self.sv.anti_alias = False
    self.sv.frame_interval = 1
    self.sv.multi_touch_enabled = True
    self.sv.shows_fps = True
    self.sv.bg_color=(1,1,1,1)
    v1width=650
    self.view1=ui.View(frame=(256+768-v1width,0,v1width,v1width))
    self.messagetext=''
    self.rbtn1=ui.SegmentedControl(frame=(5.0,340.0,204.0,34.0), segments=('auto','xyz','123','maze'), action= self.rbutton_tapped)
    self.switch1=ui.Switch(frame=(6.0,34.0,51.0,31.0),action=self.setPin)
    self.switch1.targetPin=2
    self.switch2=ui.Switch(frame=(197,167,51.0,31.0),action=self.setPin)
    self.switch2.targetPin=21
    self.sv.add_subview(self.view1)
    self.sv.add_subview(self.rbtn1)
    self.sv.add_subview(self.switch1)
    self.sv.add_subview(self.switch2)
    self.keypad1=keypadNode(scale=1.15,radius=150,position=(15,35),anchor_point=(0,0),
      keytitles=['inc','y','X','Z','dec','z','r/g','x','Y','../_'], on_output_change=self.keypad_output_changed)
    self.keypad2=keypadNode(scale=1.15,radius=150,position=(15,35),anchor_point=(0,0),
      keytitles=['1','2','3','4','5','6','7','8','9','0'],
      orientation=((0,-1),(1,0),),
      on_output_change=self.keypad_output_changed)
    self.keypad3=keypadNode(scale=1.15,radius=150,position=(15,35),anchor_point=(0,0),
      keytitles=['Put\n{NE}','N','E','[NW]\nU','Take\n{SW}','D\n{SE}','[Ctrl]','W','S','{Alt}'], on_output_change=self.keypad_output_changed)
    scene.LabelNode(position=(-30,-120), anchor_point=(0,0), text='Reset: [Ctrl Alt D]',font=('Helvetica',15),parent=self.keypad3,color='black')
    self.mode=0
    self.key=''
    self.scene_view = scn.View((0,0,self.view1.frame[2],self.view1.frame[3]), superView=self.view1)
    self.scene_view.allowsCameraControl = True
    
    self.scene_view.scene = scn.Scene()
    
    self.scene_view.delegate = self
    
    self.root_node = self.scene_view.scene.rootNode
    
    self.camera_node = scn.Node()
    self.camera_node.camera = scn.Camera()
    self.camera_node.position = (-10,1.5,2)
    self.camera_node.camera.focalLength=70
    self.root_node.addChildNode(self.camera_node)    
    self.origin_node = scn.Node()
    self.root_node.addChildNode(self.origin_node)    
    self.floor_node=scn.Node(geometry=scn.Floor())
    self.floor_node.position=(0,-1.25,0)
#    self.root_node.addChildNode(self.floor_node)    
    n=4
    scale=0.1/n
    r=3
#    self.off_led = scn.Sphere(radius=r*scale)  
    self.off_led = scn.Capsule(capRadius=r*scale,height=3*r*scale) 
    self.off_led.firstMaterial.contents=UIColor.lightGrayColor().CGColor()
#    off_led.firstMaterial().emission().setColor_(UIColor.greenColor().CGColor())
    self.green_led = scn.Capsule(capRadius=r*scale*1.1,height=3*r*scale*1.05) 
    self.green_led.firstMaterial.contents=(UIColor.grayColor().CGColor())
    self.green_led.firstMaterial.emission.contents=(UIColor.greenColor().CGColor())
    self.red_led = scn.Capsule(capRadius=r*scale*1.1,height=3*r*scale*1.05)  
    self.red_led.firstMaterial.contents=UIColor.grayColor().CGColor()
    self.red_led.firstMaterial.emission.contents=(UIColor.redColor().CGColor())
    self.led_nodes = [[[scn.Node.nodeWithGeometry(self.off_led) for k in range(n)]for j in range(n)]for i in range(n)]
    self.off_wire = scn.Capsule(capRadius=r*0.25*scale,height=20*(n+0.5)*scale) 
    self.off_wire.firstMaterial.contents=UIColor.lightGrayColor().CGColor()
    self.pos_wire = scn.Capsule(capRadius=r*0.25*scale,height=20*(n+0.5)*scale) 
    self.pos_wire.firstMaterial.contents=UIColor.lightGrayColor().CGColor()
    self.pos_wire.firstMaterial.emission.contents=(0.7,0,0)#UIColor.magentaColor().CGColor())
    self.neg_wire = scn.Capsule(capRadius=r*0.25*scale,height=20*(n+0.5)*scale) 
    self.neg_wire.firstMaterial.contents=UIColor.lightGrayColor().CGColor()
    self.neg_wire.firstMaterial.emission.contents=(0,0,0.75)#(UIColor.blueColor().CGColor())
    self.wire_nodes=[[[scn.Node.nodeWithGeometry((self.off_wire,self.neg_wire,self.pos_wire)[0]) for j in range(n)]for i in range(n)]for k in range(3)]
    wireoffset=r*scale
    for i in range(n):
      for j in range(n):
        x=(i-(n-1)/2)*20*scale
        y=(j-(n-1)/2)*20*scale
        self.root_node.addChildNode(self.wire_nodes[0][i][j])
        self.wire_nodes[0][i][j].setPosition((x+wireoffset,0,y))
        self.root_node.addChildNode(self.wire_nodes[1][i][j])
        self.wire_nodes[1][i][j].setPosition((x,y-wireoffset,0))
        self.wire_nodes[1][i][j].eulerAngles=(math.pi/2,0,0)        
        self.root_node.addChildNode(self.wire_nodes[2][i][j])
        self.wire_nodes[2][i][j].setPosition((0,x,y-wireoffset))
        self.wire_nodes[2][i][j].eulerAngles=(0,0,math.pi/2)        
        for k in range(n):
          z=(k-(n-1)/2)*20*scale
          self.root_node.addChildNode(self.led_nodes[i][j][k])
          self.led_nodes[i][j][k].setPosition((x,y,z))
          self.led_nodes[i][j][k].eulerAngles=(0.61547970867039,0,math.pi/4)
    self.index=0
    self.oldindex=0
    constraint = scn.LookAtConstraint(self.root_node)#(self.sphere_nodes[2][2][2])    
    constraint.gimbalLockEnabled = True
    self.camera_node.constraints = constraint
    
    self.light_node = scn.Node()
    self.light_node.position = (100, 0, -10)
    self.light = scn.Light()
    self.light.type = scn.LightTypeDirectional
    self.light.castsShadow = False
    self.light.color = 'white'
    self.light_node.light = self.light
    self.root_node.addChildNode(self.light_node)
    
    self.action = scn.Action.repeatActionForever(scn.Action.rotateBy(0, math.pi*2, 0, 10))
    self.origin_node.runAction(self.action)  
    
    self.sv.present(orientations= ['landscape'])
コード例 #18
0
 def reload_scene(self, sender):
     # Reload sceneview subview
     self.scene_view = scene.SceneView(frame=self.bounds)
     self.scene_view.scene = MyScene()
     self.add_subview(self.scene_view)
コード例 #19
0
ファイル: SceneViewer.py プロジェクト: cclauss/Pythonista-4
 def __init__(self, in_scene):
     self.present('full_screen', hide_title_bar=True)
     scene_view = scene.SceneView(frame=self.frame)
     scene_view.scene = in_scene()
     self.add_subview(scene_view)
     self.add_subview(self.close_button())