exman       04/12/04 14:25:13

  Log:
  pyui ̿ Ŭ̾Ʈ
  
  Status:
  
  Vendor Tag:	siminonline
  Release Tags:	alpha
  
  N simingostop2/pyui/base.py
  N simingostop2/pyui/colors.py
  N simingostop2/pyui/core.py
  N simingostop2/pyui/desktop.py
  N simingostop2/pyui/dialogs.py
  N simingostop2/pyui/entry.py
  N simingostop2/pyui/grid.py
  N simingostop2/pyui/htlib.py
  N simingostop2/pyui/html.py
  N simingostop2/pyui/htmlElements.py
  N simingostop2/pyui/layouts.py
  N simingostop2/pyui/locals.py
  N simingostop2/pyui/renderer3d.py
  N simingostop2/pyui/rendererBase.py
  N simingostop2/pyui/sheet.py
  N simingostop2/pyui/themeBase.py
  N simingostop2/pyui/tree.py
  N simingostop2/pyui/viewer.py
  N simingostop2/pyui/widgets.py
  N simingostop2/pyui/__init__.py
  N simingostop2/pyui/renderers/nebula.py
  N simingostop2/pyui/renderers/openglBase.py
  N simingostop2/pyui/renderers/openglGlut.py
  N simingostop2/pyui/renderers/openglPygame.py
  N simingostop2/pyui/renderers/pygame2D.py
  N simingostop2/pyui/renderers/unseen.py
  N simingostop2/pyui/renderers/__init__.py
  N simingostop2/pyui/themes/comic.py
  N simingostop2/pyui/themes/future.py
  N simingostop2/pyui/themes/green.py
  N simingostop2/pyui/themes/win2k.py
  N simingostop2/pyui/themes/__init__.py
  
  No conflicts created by this import


exman       04/12/04 14:40:11

  Log:
  Directory /cvsroot/simin/simingostop2/data added to the repository


exman       04/12/04 14:40:50

  Added:       .        simingostop.py
  Log:
  data丮 ߰, UnBom.ttf ߰
  
  Revision  Changes    Path
  1.1                  simingostop2/simingostop.py
  
  Index: simingostop.py
  ===================================================================
  import time
  import pyui
  from pyui.locals import *
  
  
  class game:
      def __init__(self):
  
          
          # create gui objects
          self.grid = pyui.widgets.Frame(10, 100, 400, 400, "absolute")
          self.grid.setLayout( pyui.layouts.AbsoluteLayoutManager(400,400) )
          self.b3 = pyui.widgets.Button("a long name", self.onButton)
          self.entry = pyui.entry.Entry("hahaha")
          self.entry.resize(300,200)
          self.listbox = pyui.widgets.ListBox()
          for i in range(0,20):
              self.listbox.addItem("item %d" % i, 0)
          self.listbox.resize(120,120)
  ##        self.menu = pyui.widgets.MenuBarWidget()
  ##        for i in range(0,4):
  ##            m = pyui.widgets.Menu("test1")
  ##            m.addItem("testing")
  ##            m.addItem("testing")
  ##            m.addItem("testing")            
  ##            self.menu.addMenu(m)
          
          self.grid.addChild(self.b3, (330,30))
          self.grid.addChild(self.entry, (20, 20))
          self.grid.addChild(self.listbox, (0,230))
          #self.grid.addChild(self.menu, (0,0) )
          self.grid.pack()
  
          self.console = None
          
      def onButton(self, button):
          print "Button pressed", button
          if self.console:
              self.console.destroy()
              self.console = None
              return 1
          else:
              self.console = pyui.dialogs.Console(30,300,500,300)
              return 1
  
      def onInfoButton(self, button):
          pass
  
  
  def run():
      pyui.init(800, 600, "2d")
  
      g = game()
      pyui.run()
  
  
  if __name__ == '__main__':
      run()
  
  
  


exman       04/12/04 14:40:51

  Added:       data     UnBom.ttf
  Log:
  data丮 ߰, UnBom.ttf ߰
  
  Revision  Changes    Path
  1.1                  simingostop2/data/UnBom.ttf
  
  	<<Binary file>>
  
  


exman       04/12/04 14:40:51

  Modified:    pyui/renderers pygame2D.py
  Log:
  data丮 ߰, UnBom.ttf ߰
  
  Revision  Changes    Path
  1.2       +1 -1      simingostop2/pyui/renderers/pygame2D.py
  
  Index: pygame2D.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/renderers/pygame2D.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- pygame2D.py	4 Dec 2004 05:25:11 -0000	1.1
  +++ pygame2D.py	4 Dec 2004 05:40:51 -0000	1.2
  @@ -72,7 +72,7 @@
           pyui.locals.K_F12       = 293
   
           try:
  -            self.font = pygame.font.Font("font.ttf", 14)
  +            self.font = pygame.font.Font("data/UnBom.ttf", 14)
           except:
               print "Couldn't find arial.ttf - resorting to default font"
               self.font = pygame.font.Font(None, 12)
  
  
  


exman       04/12/04 15:10:16

  Log:
  Directory /cvsroot/simin/simingostop2/data/background added to the repository


exman       04/12/04 15:19:52

  Modified:    .        simingostop.py
  Log:
  ׶ ̹ ߰
  
  Revision  Changes    Path
  1.2       +16 -2     simingostop2/simingostop.py
  
  Index: simingostop.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/simingostop.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- simingostop.py	4 Dec 2004 05:40:50 -0000	1.1
  +++ simingostop.py	4 Dec 2004 06:19:52 -0000	1.2
  @@ -5,8 +5,6 @@
   
   class game:
       def __init__(self):
  -
  -        
           # create gui objects
           self.grid = pyui.widgets.Frame(10, 100, 400, 400, "absolute")
           self.grid.setLayout( pyui.layouts.AbsoluteLayoutManager(400,400) )
  @@ -32,6 +30,22 @@
           self.grid.pack()
   
           self.console = None
  +
  +        pyui.desktop.getRenderer().setBackMethod(self.drawBack)
  +    def drawBack(self):
  +        renderer = pyui.desktop.getRenderer()
  +        renderer.setup2D()
  +
  +        renderer.clear()
  +        renderer.drawImage((0,0,800,600), "data/background/menubg.png")
  +        """
  +        renderer.drawLine(x*80,1,x*80, 600, (0,255,255,255) )
  +
  +        renderer.drawRect( pyui.colors.red, (100,100,600,400) )            
  +
  +        renderer.teardown2D()
  +        """
  +        
           
       def onButton(self, button):
           print "Button pressed", button
  
  
  


exman       04/12/04 15:19:52

  Added:       data/background menubg.png
  Log:
  ׶ ̹ ߰
  
  Revision  Changes    Path
  1.1                  simingostop2/data/background/menubg.png
  
  	<<Binary file>>
  
  


exman       04/12/04 15:19:52

  Modified:    pyui     rendererBase.py
  Log:
  ׶ ̹ ߰
  
  Revision  Changes    Path
  1.2       +1 -1      simingostop2/pyui/rendererBase.py
  
  Index: rendererBase.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/rendererBase.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- rendererBase.py	4 Dec 2004 05:25:08 -0000	1.1
  +++ rendererBase.py	4 Dec 2004 06:19:52 -0000	1.2
  @@ -88,7 +88,7 @@
               now = time.time()
               if now - self.last >= 1:
                   self.last = now
  -                print "FPS: %d" % self.frame
  +                #print "FPS: %d" % self.frame
                   self.frame = 0
               
               if callback:
  
  
  


exman       04/12/04 15:27:23

  Log:
  Directory /cvsroot/simin/simingostop2/data/voice added to the repository


exman       04/12/04 15:27:23

  Log:
  Directory /cvsroot/simin/simingostop2/data/sound added to the repository


exman       04/12/04 15:27:23

  Log:
  Directory /cvsroot/simin/simingostop2/data/music added to the repository


exman       04/12/04 15:28:20

  Added:       data/music lobby.ogg
  Log:
  lobby.ogg ߰
  
  Revision  Changes    Path
  1.1                  simingostop2/data/music/lobby.ogg
  
  	<<Binary file>>
  
  


exman       04/12/04 16:46:23

  Modified:    .        simingostop.py
  Log:
  snd   BGM ߰
  
  Revision  Changes    Path
  1.3       +7 -1      simingostop2/simingostop.py
  
  Index: simingostop.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/simingostop.py,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- simingostop.py	4 Dec 2004 06:19:52 -0000	1.2
  +++ simingostop.py	4 Dec 2004 07:46:23 -0000	1.3
  @@ -1,6 +1,7 @@
   import time
   import pyui
   from pyui.locals import *
  +from pyui import snd
   
   
   class game:
  @@ -32,18 +33,23 @@
           self.console = None
   
           pyui.desktop.getRenderer().setBackMethod(self.drawBack)
  +
  +        snd.play("voice", "humphrey")
  +        print "playmusic"
  +        snd.playmusic("lobby.ogg")
  +
       def drawBack(self):
           renderer = pyui.desktop.getRenderer()
           renderer.setup2D()
   
           renderer.clear()
           renderer.drawImage((0,0,800,600), "data/background/menubg.png")
  +        renderer.teardown2D()
           """
           renderer.drawLine(x*80,1,x*80, 600, (0,255,255,255) )
   
           renderer.drawRect( pyui.colors.red, (100,100,600,400) )            
   
  -        renderer.teardown2D()
           """
           
           
  
  
  


exman       04/12/04 16:46:23

  Added:       data/voice humphrey.ogg
  Log:
  snd   BGM ߰
  
  Revision  Changes    Path
  1.1                  simingostop2/data/voice/humphrey.ogg
  
  	<<Binary file>>
  
  


exman       04/12/04 16:46:23

  Modified:    pyui     core.py rendererBase.py
  Added:       pyui     snd.py
  Log:
  snd   BGM ߰
  
  Revision  Changes    Path
  1.2       +2 -0      simingostop2/pyui/core.py
  
  Index: core.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/core.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- core.py	4 Dec 2004 05:25:06 -0000	1.1
  +++ core.py	4 Dec 2004 07:46:23 -0000	1.2
  @@ -22,6 +22,7 @@
   import colors
   import string
   import os
  +import snd
   
   from desktop import Desktop, readTimer
   from rendererBase import RendererBase
  @@ -85,6 +86,7 @@
       
       gDesktop = Desktop(gRenderer, w, h, fullscreen, theTheme)
       colors.init(gRenderer)
  +    snd.initialize()        # by exman
       return gDesktop
       
   def quit():
  
  
  
  1.3       +3 -0      simingostop2/pyui/rendererBase.py
  
  Index: rendererBase.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/rendererBase.py,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- rendererBase.py	4 Dec 2004 06:19:52 -0000	1.2
  +++ rendererBase.py	4 Dec 2004 07:46:23 -0000	1.3
  @@ -17,6 +17,7 @@
   import time
   
   from pyui.desktop import getDesktop
  +import snd
   
   class RendererBase:
       """Base class for renderers to implement. The renderer hands out window handles when windows
  @@ -97,6 +98,8 @@
                   getDesktop().draw()
                   getDesktop().update()
   
  +        snd.finish_playmusic() # by exman
  +
       def setBackMethod(self, drawBackMethod, *args):
           """Set the method used to draw the background.
           """
  
  
  
  1.1                  simingostop2/pyui/snd.py
  
  Index: snd.py
  ===================================================================
  """audio class, helps everyone to audio"""
  
  import pygame, os
  from pygame.locals import *
  
  
  mixer = music = None
  sound_cache = {}
  
  
  def initialize():
      global mixer, music
      try:
          import pygame.mixer as pymix
          pymix.init(22000, 8, 0)
          mixer = pymix
          music = pymix.music
          return 1
      except (ImportError, pygame.error):
          return 0
  
  def preloadvoice(*names):
      "loads a sound into the cache"
      if not mixer:
          for name in names:
              sound_cache[name] = None
          return
      for name in names:
          if not sound_cache.has_key(name):
              fullname = os.path.join('data', 'voice', name+'.ogg')
              try: sound = mixer.Sound(fullname)
              except: sound = None
              sound_cache[name] = sound
  def preloadsound(*names):
      "loads a sound into the cache"
      if not mixer:
          for name in names:
              sound_cache[name] = None
          return
      for name in names:
          if not sound_cache.has_key(name):
              fullname = os.path.join('data', 'sound', name+'.ogg')
              try: sound = mixer.Sound(fullname)
              except: sound = None
              sound_cache[name] = sound
  def preloadmusic(*names):
      "loads a sound into the cache"
      if not mixer:
          for name in names:
              sound_cache[name] = None
          return
      for name in names:
          if not sound_cache.has_key(name):
              fullname = os.path.join('data', 'music', name+'.ogg')
              try: sound = mixer.Sound(fullname)
              except: sound = None
              sound_cache[name] = sound
  
  def fetch(type, name):
      if not sound_cache.has_key(name):
          if type=="audio":
              preloadaudio(name)
          elif type=="voice":
              preloadvoice(name)
          elif type=="music":
              preloadmusic(name)
      return sound_cache[name]
  
  
  def play(type, name, volume=1.0, pos=-1):
      prefvolume = [0, 0.6, 1.0][2]
      volume *= prefvolume
      if not volume:
          return
      sound = fetch(type, name)
      if sound:
          chan = sound.play()
          if not chan:
              chan = pygame.mixer.find_channel(1)
              chan.play(sound)
          if chan:
              if pos == -1:
                  percent = 0.5
              else:
                  percent = (pos / 700.0)
              inv = 1.0 - percent
              chan.set_volume(inv*volume, percent*volume)
  
  CurrentSong = None
  CurrentVolume = 1.0
  SwitchingSongs = 0
  def playmusic(musicname, volume=1.0):
      if not music: return
      global CurrentSong, SwitchingSongs, CurrentVolume
      if musicname == CurrentSong:
          return
      CurrentSong = musicname
      CurrentVolume = volume
      if SwitchingSongs:
          CurrentSong = musicname
      SwitchingSongs = 1
      if music.get_busy():
          #music.set_endevent(INPUT.FINISHMUSIC)
          music.fadeout(1000)
      else:
          prefvolume = [0, 0.6, 1.0][2]
          fullname = os.path.join('data', 'music', musicname)
          music.load(fullname)
          music.play(-1)
          music.set_volume(prefvolume*CurrentVolume)
  
  def finish_playmusic():
      global CurrentSong, SwitchingSongs, CurrentVolume
      SwitchingSongs = 0
      prefvolume = [0, 0.6, 1.0][2]
      fullname = os.path.join('data', 'music', CurrentSong)
      music.load(fullname)
      music.play(-1)
      music.set_volume(prefvolume*CurrentVolume)
  if __name__=='__main__':
      pygame.init()
      winstyle = 0  # |FULLSCREEN
      bestdepth = pygame.display.mode_ok(Rect(0, 0, 640, 480).size, winstyle, 32)
      screen = pygame.display.set_mode(Rect(0, 0, 640, 480).size, winstyle, bestdepth)
  
      initialize()
      playmusic("lobby.ogg")
      while True:
          #get input
          for event in pygame.event.get():
              print event
  
  
  


exman       04/12/04 16:46:23

  Modified:    pyui/renderers pygame2D.py
  Log:
  snd   BGM ߰
  
  Revision  Changes    Path
  1.3       +14 -0     simingostop2/pyui/renderers/pygame2D.py
  
  Index: pygame2D.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/renderers/pygame2D.py,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- pygame2D.py	4 Dec 2004 05:40:51 -0000	1.2
  +++ pygame2D.py	4 Dec 2004 07:46:23 -0000	1.3
  @@ -33,10 +33,14 @@
       def __init__(self, w, h, fullscreen, title):
           pyui.core.RendererBase.__init__(self, w, h, fullscreen, title)
           pygame.init()
  +        self.width = w
  +        self.height = h
           if fullscreen:
               self.screen = pygame.display.set_mode((w, h), FULLSCREEN | SWSURFACE)
  +            self.fullscreen = 1
           else:
               self.screen = pygame.display.set_mode((w, h))
  +            self.fullscreen = 0
           self.screen.set_alpha(255)
               
           pygame.key.set_mods(KMOD_NONE)
  @@ -224,6 +228,16 @@
                   getDesktop().postUserEvent(pyui.locals.MOUSEMOVE, event.pos[0], event.pos[1])
   
               elif event.type == KEYDOWN:
  +                if event.key == pygame.K_RETURN:
  +                    if event.mod&pygame.KMOD_ALT:
  +                        if self.fullscreen==1:
  +                            self.screen = pygame.display.set_mode((self.width, self.height))
  +                            self.fullscreen = 0
  +                        else:
  +                            self.screen = pygame.display.set_mode((self.width, self.height), FULLSCREEN | SWSURFACE)
  +                            self.fullscreen = 1
  +
  +
                   character = event.unicode
                   code = 0
                   if len(character) > 0:
  
  
  


exman       04/12/04 16:48:01

  Added:       .        .cvsignore
  Log:
  
  
  Revision  Changes    Path
  1.1                  simingostop2/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  *.pyc
  
  
  


exman       04/12/04 16:48:01

  Added:       pyui     .cvsignore
  Log:
  
  
  Revision  Changes    Path
  1.1                  simingostop2/pyui/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  *.pyc
  
  
  


exman       04/12/04 16:48:01

  Added:       pyui/renderers .cvsignore
  Log:
  
  
  Revision  Changes    Path
  1.1                  simingostop2/pyui/renderers/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  *.pyc
  
  
  


exman       04/12/04 16:48:01

  Added:       pyui/themes .cvsignore
  Log:
  
  
  Revision  Changes    Path
  1.1                  simingostop2/pyui/themes/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  *.pyc
  
  
  


exman       04/12/04 20:17:29

  Modified:    .        simingostop.py
  Added:       .        menu.py
  Log:
  pyui.widgets.BackgroundButton ߰, ùȭ鿡 ư ߰
  
  Revision  Changes    Path
  1.4       +128 -72   simingostop2/simingostop.py
  
  Index: simingostop.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/simingostop.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- simingostop.py	4 Dec 2004 07:46:23 -0000	1.3
  +++ simingostop.py	4 Dec 2004 11:17:29 -0000	1.4
  @@ -1,78 +1,134 @@
  -import time
  -import pyui
  -from pyui.locals import *
  -from pyui import snd
  -
  -
  -class game:
  -    def __init__(self):
  -        # create gui objects
  -        self.grid = pyui.widgets.Frame(10, 100, 400, 400, "absolute")
  -        self.grid.setLayout( pyui.layouts.AbsoluteLayoutManager(400,400) )
  -        self.b3 = pyui.widgets.Button("a long name", self.onButton)
  -        self.entry = pyui.entry.Entry("hahaha")
  -        self.entry.resize(300,200)
  -        self.listbox = pyui.widgets.ListBox()
  -        for i in range(0,20):
  -            self.listbox.addItem("item %d" % i, 0)
  -        self.listbox.resize(120,120)
  -##        self.menu = pyui.widgets.MenuBarWidget()
  -##        for i in range(0,4):
  -##            m = pyui.widgets.Menu("test1")
  -##            m.addItem("testing")
  -##            m.addItem("testing")
  -##            m.addItem("testing")            
  -##            self.menu.addMenu(m)
  -        
  -        self.grid.addChild(self.b3, (330,30))
  -        self.grid.addChild(self.entry, (20, 20))
  -        self.grid.addChild(self.listbox, (0,230))
  -        #self.grid.addChild(self.menu, (0,0) )
  -        self.grid.pack()
  -
  -        self.console = None
  -
  -        pyui.desktop.getRenderer().setBackMethod(self.drawBack)
  -
  -        snd.play("voice", "humphrey")
  -        print "playmusic"
  -        snd.playmusic("lobby.ogg")
  -
  -    def drawBack(self):
  -        renderer = pyui.desktop.getRenderer()
  -        renderer.setup2D()
  -
  -        renderer.clear()
  -        renderer.drawImage((0,0,800,600), "data/background/menubg.png")
  -        renderer.teardown2D()
  -        """
  -        renderer.drawLine(x*80,1,x*80, 600, (0,255,255,255) )
  -
  -        renderer.drawRect( pyui.colors.red, (100,100,600,400) )            
  -
  -        """
  -        
  -        
  -    def onButton(self, button):
  -        print "Button pressed", button
  -        if self.console:
  -            self.console.destroy()
  -            self.console = None
  -            return 1
  -        else:
  -            self.console = pyui.dialogs.Console(30,300,500,300)
  -            return 1
  -
  -    def onInfoButton(self, button):
  -        pass
  +import sys, os
   
  +#Pretty Error Handling Code...
  +def __windowsbox(title, message):
  +    raise ImportError #the MessageBox command is crashing!
  +    import win32ui, win32con
  +    win32ui.MessageBox(message, title, win32con.MB_ICONERROR)
  +
  +def __wxpythonbox(title, message):
  +    import wxPython.wx as wx
  +    class LameApp(wx.wxApp):
  +        def OnInit(self): return 1
  +    app = LameApp()
  +    dlg = wx.wxMessageDialog(None, message, title, wx.wxOK|wx.wxICON_EXCLAMATION)
  +    dlg.ShowModal()
  +    dlg.Destroy()
  +
  +def __tkinterbox(title, message):
  +    import Tkinter, tkMessageBox
  +    Tkinter.Tk().wm_withdraw()
  +    tkMessageBox.showerror(title, message)
  +
  +def __pygamebox(title, message):
  +    try:
  +        import pygame
  +        pygame.quit() #clean out anything running
  +        pygame.display.init()
  +        pygame.font.init()
  +        screen = pygame.display.set_mode((460, 140))
  +        pygame.display.set_caption(title)
  +        font = pygame.font.Font(None, 18)
  +        foreg, backg, liteg = (0, 0, 0), (180, 180, 180), (210, 210, 210)
  +        ok = font.render('Ok', 1, foreg, liteg)
  +        okbox = ok.get_rect().inflate(200, 10)
  +        okbox.centerx = screen.get_rect().centerx
  +        okbox.bottom = screen.get_rect().bottom - 10
  +        screen.fill(backg)
  +        screen.fill(liteg, okbox)
  +        screen.blit(ok, okbox.inflate(-200, -10))
  +        pos = [10, 10]
  +        for text in message.split('\n'):
  +            if text:
  +                msg = font.render(text, 1, foreg, backg)
  +                screen.blit(msg, pos)
  +            pos[1] += font.get_height()
  +        pygame.display.flip()
  +        stopkeys = pygame.K_ESCAPE, pygame.K_SPACE, pygame.K_RETURN, pygame.K_KP_ENTER
  +        while 1:
  +            e = pygame.event.wait()
  +            if e.type == pygame.QUIT or \
  +                       (e.type == pygame.KEYDOWN and e.key in stopkeys) or \
  +                       (e.type == pygame.MOUSEBUTTONDOWN and okbox.collidepoint(e.pos)):
  +                break
  +        pygame.quit()
  +    except pygame.error:
  +        raise ImportError
  +
  +handlers = __pygamebox, __tkinterbox, __wxpythonbox, __windowsbox
  +
  +def __showerrorbox(message):
  +    title = os.path.splitext(os.path.split(sys.argv[0])[1])[0]
  +    title = title.capitalize() + ' Error'
  +    for e in handlers:
  +        try:
  +            e(title, message)
  +            break
  +        except (ImportError, NameError, AttributeError):
  +            pass
  +
  +def errorbox(message):
  +    message = str(message)
  +    if not message: message = 'Error'
  +    __showerrorbox(message)
  +    sys.stderr.write('ERROR: ' + message + '\n')
  +    raise SystemExit
  +
  +def exception_handler():
  +    import traceback
  +    type, info, trace = sys.exc_info()
  +    tracetop = traceback.extract_tb(trace)[-1]
  +    tracetext = 'File %s, Line %d' % tracetop[:2]
  +    if tracetop[2] != '?':
  +        tracetext += ', Function %s' % tracetop[2]
  +    exception_message = '%s:\n%s\n\n%s\n"%s"'
  +    message = exception_message % (str(type), str(info), tracetext, tracetop[3])
  +    if type not in (KeyboardInterrupt, SystemExit):
  +        __showerrorbox(message)
  +    raise
  +
  +
  +def checkdependencies():
  +    "only returns if everything looks ok"
  +    msgs = []
  +
  +    #first, we need python >= 2.1
  +    if int(sys.version[0]) < 2:
  +        errorbox('Requires Python-2.1 or Greater')
  +
  +    #is correct pygame found?
  +    try:
  +        import pygame
  +        if pygame.ver < '1.5.6':
  +            msgs.append('Requires Pygame-1.5.6 or Greater, You Have ' + pygame.ver)
  +    except ImportError:
  +        msgs.append("Cannot import Pygame, install version 1.5.6 or higher")
  +        pygame = None
  +
  +    #check that we have FONT and IMAGE
  +    if pygame:
  +        if not pygame.font:
  +            msgs.append('Pygame requires the SDL_ttf library, not available')
  +        if not pygame.image or not pygame.image.get_extended():
  +            msgs.append('Pygame requires the SDL_image library, not available')
  +
  +    if msgs:
  +        msg = '\n'.join(msgs)
  +        errorbox(msg)
   
  -def run():
  -    pyui.init(800, 600, "2d")
  -
  -    g = game()
  -    pyui.run()
   
   
   if __name__ == '__main__':
  +    checkdependencies()
  +    import time
  +    import pyui
  +    from pyui.locals import *
  +    from pyui import snd
  +    import menu
  +    def run():
  +
  +        pyui.init(800, 600, "2d")
  +
  +        g = menu.game()
  +        pyui.run()
       run()
  
  
  
  1.1                  simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  import time
  import pyui
  from pyui.locals import *
  from pyui import snd
  from pyui.base import *
  
  class game:
      def __init__(self):
          # create gui objects
  
          self.btnLobby = pyui.widgets.BackgroundImageButton(188-7, 447-25, 156+6, 46+6, "data/menu_lobby.png")
          self.btnNews = pyui.widgets.BackgroundImageButton(459-7, 447-25, 156+6, 46+6, "data/menu_news.png")
          self.btnCreds = pyui.widgets.BackgroundImageButton(56-7, 520-25, 156+6, 46+6, "data/menu_creds.png")
          self.btnSetup = pyui.widgets.BackgroundImageButton(322-7, 520-25, 156+6, 46+6, "data/menu_setup.png")
          self.btnQuit = pyui.widgets.BackgroundImageButton(585-7, 520-25, 156+6, 46+6, "data/menu_quit.png")
  
          pyui.desktop.getRenderer().setBackMethod(self.drawBack)
  
          snd.play("voice", "humphrey")
          print "playmusic"
          snd.playmusic("lobby.ogg")
  
      def drawBack(self):
          renderer = pyui.desktop.getRenderer()
          renderer.setup2D()
  
          renderer.clear()
          renderer.drawImage((0,0,800,600), "data/background/menubg.png")
          renderer.teardown2D()
          """
          renderer.drawLine(x*80,1,x*80, 600, (0,255,255,255) )
  
          renderer.drawRect( pyui.colors.red, (100,100,600,400) )            
  
          """
          #pyui.desktop.getTheme().drawButton((100,100,100,60), "haha", True, 0, 1)
          
          
      def onButton(self, button):
          print "Button pressed", button
          if self.console:
              self.console.destroy()
              self.console = None
              return 1
          else:
              self.console = pyui.dialogs.Console(30,300,500,300)
              return 1
  
      def onInfoButton(self, button):
          pass
  
  
  
  
  


exman       04/12/04 20:17:29

  Added:       data     menu_creds.png menu_lobby.png menu_news.png
                        menu_quit.png menu_setup.png
  Log:
  pyui.widgets.BackgroundButton ߰, ùȭ鿡 ư ߰
  
  Revision  Changes    Path
  1.1                  simingostop2/data/menu_creds.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/data/menu_lobby.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/data/menu_news.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/data/menu_quit.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/data/menu_setup.png
  
  	<<Binary file>>
  
  


exman       04/12/04 20:17:29

  Modified:    pyui     widgets.py
  Log:
  pyui.widgets.BackgroundButton ߰, ùȭ鿡 ư ߰
  
  Revision  Changes    Path
  1.2       +26 -1     simingostop2/pyui/widgets.py
  
  Index: widgets.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/widgets.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- widgets.py	4 Dec 2004 05:25:10 -0000	1.1
  +++ widgets.py	4 Dec 2004 11:17:29 -0000	1.2
  @@ -1638,7 +1638,7 @@
           """
           if not self.show:
               return
  -        self.hitList = getTheme().drawFrame( (0,0,self.width, self.height), self.title, self.backImage)
  +        self.hitList = []#getTheme().drawFrame( (0,0,self.width, self.height), self.title, self.backImage)
           Window.draw(self, renderer)        
           
       def replacePanel(self, panel):
  @@ -2249,3 +2249,28 @@
           self.hitList = None
           Base.destroy(self)
   
  +class BackgroundButton(Frame):
  +    def __init__(self, x, y, w, h, text, callback=None):
  +        Frame.__init__(self, x, y ,w, h, "button")
  +        self.button = Button(unicode(text, "euc-kr"), callback)
  +        self.setLayout( layouts.GridLayoutManager(1, 1) )
  +        self.addChild(self.button)
  +        self.pack()
  +    def draw(self, renderer):
  +        if not self.show:
  +            return
  +        self.hitList = []
  +        Window.draw(self, renderer)        
  +
  +class BackgroundImageButton(Frame):
  +    def __init__(self, x, y, w, h, filename, callback=None):
  +        Frame.__init__(self, x, y ,w, h, "button")
  +        self.button = ImageButton(filename, callback)
  +        self.setLayout( layouts.GridLayoutManager(1, 1) )
  +        self.addChild(self.button)
  +        self.pack()
  +    def draw(self, renderer):
  +        if not self.show:
  +            return
  +        self.hitList = []
  +        Window.draw(self, renderer)        
  
  
  


exman       04/12/04 20:35:49

  Modified:    .        menu.py
  Log:
  quit ư 
  
  Revision  Changes    Path
  1.2       +3 -1      simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- menu.py	4 Dec 2004 11:17:29 -0000	1.1
  +++ menu.py	4 Dec 2004 11:35:49 -0000	1.2
  @@ -12,7 +12,7 @@
           self.btnNews = pyui.widgets.BackgroundImageButton(459-7, 447-25, 156+6, 46+6, "data/menu_news.png")
           self.btnCreds = pyui.widgets.BackgroundImageButton(56-7, 520-25, 156+6, 46+6, "data/menu_creds.png")
           self.btnSetup = pyui.widgets.BackgroundImageButton(322-7, 520-25, 156+6, 46+6, "data/menu_setup.png")
  -        self.btnQuit = pyui.widgets.BackgroundImageButton(585-7, 520-25, 156+6, 46+6, "data/menu_quit.png")
  +        self.btnQuit = pyui.widgets.BackgroundImageButton(585-7, 520-25, 156+6, 46+6, "data/menu_quit.png", self.onQuit)
   
           pyui.desktop.getRenderer().setBackMethod(self.drawBack)
   
  @@ -35,6 +35,8 @@
           """
           #pyui.desktop.getTheme().drawButton((100,100,100,60), "haha", True, 0, 1)
           
  +    def onQuit(self, button):
  +        pyui.desktop.getDesktop().quit()
           
       def onButton(self, button):
           print "Button pressed", button
  
  
  


exman       04/12/04 20:35:49

  Modified:    pyui     snd.py
  Log:
  quit ư 
  
  Revision  Changes    Path
  1.2       +2 -0      simingostop2/pyui/snd.py
  
  Index: snd.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/snd.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- snd.py	4 Dec 2004 07:46:23 -0000	1.1
  +++ snd.py	4 Dec 2004 11:35:49 -0000	1.2
  @@ -110,6 +110,7 @@
           music.set_volume(prefvolume*CurrentVolume)
   
   def finish_playmusic():
  +    return
       global CurrentSong, SwitchingSongs, CurrentVolume
       SwitchingSongs = 0
       prefvolume = [0, 0.6, 1.0][2]
  @@ -117,6 +118,7 @@
       music.load(fullname)
       music.play(-1)
       music.set_volume(prefvolume*CurrentVolume)
  +
   if __name__=='__main__':
       pygame.init()
       winstyle = 0  # |FULLSCREEN
  
  
  


exman       04/12/04 20:56:41

  Modified:    pyui     widgets.py
  Log:
  
  
  Revision  Changes    Path
  1.3       +4 -0      simingostop2/pyui/widgets.py
  
  Index: widgets.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/widgets.py,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- widgets.py	4 Dec 2004 11:17:29 -0000	1.2
  +++ widgets.py	4 Dec 2004 11:56:41 -0000	1.3
  @@ -2261,6 +2261,8 @@
               return
           self.hitList = []
           Window.draw(self, renderer)        
  +    def button(self):
  +        return self.button
   
   class BackgroundImageButton(Frame):
       def __init__(self, x, y, w, h, filename, callback=None):
  @@ -2274,3 +2276,5 @@
               return
           self.hitList = []
           Window.draw(self, renderer)        
  +    def button(self):
  +        return self.button
  
  
  


exman       04/12/04 20:58:24

  Modified:    pyui     widgets.py
  Log:
  
  
  Revision  Changes    Path
  1.4       +4 -4      simingostop2/pyui/widgets.py
  
  Index: widgets.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/widgets.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- widgets.py	4 Dec 2004 11:56:41 -0000	1.3
  +++ widgets.py	4 Dec 2004 11:58:24 -0000	1.4
  @@ -2252,7 +2252,7 @@
   class BackgroundButton(Frame):
       def __init__(self, x, y, w, h, text, callback=None):
           Frame.__init__(self, x, y ,w, h, "button")
  -        self.button = Button(unicode(text, "euc-kr"), callback)
  +        self.m_button = Button(unicode(text, "euc-kr"), callback)
           self.setLayout( layouts.GridLayoutManager(1, 1) )
           self.addChild(self.button)
           self.pack()
  @@ -2262,12 +2262,12 @@
           self.hitList = []
           Window.draw(self, renderer)        
       def button(self):
  -        return self.button
  +        return self.m_button
   
   class BackgroundImageButton(Frame):
       def __init__(self, x, y, w, h, filename, callback=None):
           Frame.__init__(self, x, y ,w, h, "button")
  -        self.button = ImageButton(filename, callback)
  +        self.m_button = ImageButton(filename, callback)
           self.setLayout( layouts.GridLayoutManager(1, 1) )
           self.addChild(self.button)
           self.pack()
  @@ -2277,4 +2277,4 @@
           self.hitList = []
           Window.draw(self, renderer)        
       def button(self):
  -        return self.button
  +        return self.m_button
  
  
  


exman       04/12/04 21:01:09

  Modified:    pyui     widgets.py
  Log:
  
  
  Revision  Changes    Path
  1.5       +2 -2      simingostop2/pyui/widgets.py
  
  Index: widgets.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/widgets.py,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- widgets.py	4 Dec 2004 11:58:24 -0000	1.4
  +++ widgets.py	4 Dec 2004 12:01:09 -0000	1.5
  @@ -2254,7 +2254,7 @@
           Frame.__init__(self, x, y ,w, h, "button")
           self.m_button = Button(unicode(text, "euc-kr"), callback)
           self.setLayout( layouts.GridLayoutManager(1, 1) )
  -        self.addChild(self.button)
  +        self.addChild(self.m_button)
           self.pack()
       def draw(self, renderer):
           if not self.show:
  @@ -2269,7 +2269,7 @@
           Frame.__init__(self, x, y ,w, h, "button")
           self.m_button = ImageButton(filename, callback)
           self.setLayout( layouts.GridLayoutManager(1, 1) )
  -        self.addChild(self.button)
  +        self.addChild(self.m_button)
           self.pack()
       def draw(self, renderer):
           if not self.show:
  
  
  


exman       04/12/04 21:04:18

  Modified:    pyui     widgets.py
  Log:
  
  
  Revision  Changes    Path
  1.6       +1 -1      simingostop2/pyui/widgets.py
  
  Index: widgets.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/widgets.py,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- widgets.py	4 Dec 2004 12:01:09 -0000	1.5
  +++ widgets.py	4 Dec 2004 12:04:18 -0000	1.6
  @@ -1638,7 +1638,7 @@
           """
           if not self.show:
               return
  -        self.hitList = []#getTheme().drawFrame( (0,0,self.width, self.height), self.title, self.backImage)
  +        self.hitList = getTheme().drawFrame( (0,0,self.width, self.height), self.title, self.backImage)
           Window.draw(self, renderer)        
           
       def replacePanel(self, panel):
  
  
  


exman       04/12/04 23:28:16

  Modified:    .        menu.py
  Log:
  α  ̾α ߰
  
  Revision  Changes    Path
  1.3       +43 -2     simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- menu.py	4 Dec 2004 11:35:49 -0000	1.2
  +++ menu.py	4 Dec 2004 14:28:16 -0000	1.3
  @@ -1,14 +1,53 @@
  +# -*- coding: euc-kr -*-
   import time
   import pyui
   from pyui.locals import *
   from pyui import snd
   from pyui.base import *
  +import random
  +
  +class loginDialog(pyui.dialogs.Dialog):
  +    """Dialog to setup options for a trade route"""
  +    def __init__(self):
  +        pyui.dialogs.Dialog.__init__(self, 300, 250, 200, 120, "ùOnline::")
  +        self.setLayout(pyui.layouts.GridLayoutManager(1,2))
  +        self.topPanel = pyui.widgets.Panel()
  +        self.lbl_id = pyui.widgets.Label("̵")
  +        self.ed_id = pyui.widgets.Edit("", 32, self.onButton)
  +
  +        self.lbl_passwd = pyui.widgets.Label("йȣ")
  +        self.ed_passwd = pyui.widgets.Edit("", 32, self.onButton)
  +
  +        self.button = pyui.widgets.Button("α", self.onButton)
  +        self.topPanel.setLayout(pyui.layouts.GridLayoutManager(2,2))
  +        self.topPanel.addChild(self.lbl_id)
  +        self.topPanel.addChild(self.ed_id)
  +        self.topPanel.addChild(self.lbl_passwd)
  +        self.topPanel.addChild(self.ed_passwd)
  +        self.topPanel.pack()
  +        
  +        self.addChild(self.topPanel)
  +        self.addChild(self.button)
  +        self.pack()
  +        snd.play("voice", "welcomesimin%d" % random.randint(0, 3))
  +
  +    def onButton(self, button):
  +        print "haha"
  +
  +    def close(self):
  +        self.topPanel = None
  +        self.lbl_id = None
  +        self.lbl_passwd = None
  +        self.ed_id = None
  +        self.ed_passwd = None
  +        pyui.dialogs.Dialog.close(self)
  +        
   
   class game:
       def __init__(self):
           # create gui objects
   
  -        self.btnLobby = pyui.widgets.BackgroundImageButton(188-7, 447-25, 156+6, 46+6, "data/menu_lobby.png")
  +        self.btnLobby = pyui.widgets.BackgroundImageButton(188-7, 447-25, 156+6, 46+6, "data/menu_lobby.png", self.onLobby)
           self.btnNews = pyui.widgets.BackgroundImageButton(459-7, 447-25, 156+6, 46+6, "data/menu_news.png")
           self.btnCreds = pyui.widgets.BackgroundImageButton(56-7, 520-25, 156+6, 46+6, "data/menu_creds.png")
           self.btnSetup = pyui.widgets.BackgroundImageButton(322-7, 520-25, 156+6, 46+6, "data/menu_setup.png")
  @@ -17,7 +56,6 @@
           pyui.desktop.getRenderer().setBackMethod(self.drawBack)
   
           snd.play("voice", "humphrey")
  -        print "playmusic"
           snd.playmusic("lobby.ogg")
   
       def drawBack(self):
  @@ -34,6 +72,9 @@
   
           """
           #pyui.desktop.getTheme().drawButton((100,100,100,60), "haha", True, 0, 1)
  +    def onLobby(self, button):
  +        self.td = loginDialog()
  +        self.td.doModal()
           
       def onQuit(self, button):
           pyui.desktop.getDesktop().quit()
  
  
  


exman       04/12/04 23:28:16

  Added:       data/voice welcomesimin0.ogg welcomesimin1.ogg
                        welcomesimin2.ogg welcomesimin3.ogg
  Log:
  α  ̾α ߰
  
  Revision  Changes    Path
  1.1                  simingostop2/data/voice/welcomesimin0.ogg
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/data/voice/welcomesimin1.ogg
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/data/voice/welcomesimin2.ogg
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/data/voice/welcomesimin3.ogg
  
  	<<Binary file>>
  
  


exman       04/12/04 23:28:16

  Modified:    pyui     widgets.py
  Log:
  α  ̾α ߰
  
  Revision  Changes    Path
  1.7       +3 -2      simingostop2/pyui/widgets.py
  
  Index: widgets.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/widgets.py,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- widgets.py	4 Dec 2004 12:04:18 -0000	1.6
  +++ widgets.py	4 Dec 2004 14:28:16 -0000	1.7
  @@ -48,7 +48,7 @@
               self.color = color
           else:
               self.color = self.fgColor
  -        self.setText(text)
  +        self.setText(unicode(text, "euc-kr"))
   
       def draw(self, renderer):
           if self.show:
  @@ -119,6 +119,7 @@
           self.fgColor=fgColor
           self.bgColor=bgColor
           self.roColor=roColor
  +        text = unicode(text, "euc-kr")
   
           self.setText(text)
           self.registerEvent(pyui.locals.LMOUSEBUTTONDOWN, self._pyuiMouseDown)
  @@ -1591,7 +1592,7 @@
           self.theme = getTheme()
           self.innerWidth = w
           self.innerHeight = h
  -        self.title = title
  +        self.title = unicode(title, "euc-kr")
   
           self.panelOffsetLeft = 0
           self.panelOffsetTop = 0
  
  
  


exman       04/12/04 23:49:07

  Modified:    .        menu.py
  Log:
  Edit  onChar ̺Ʈ 
  
  Revision  Changes    Path
  1.4       +1 -1      simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- menu.py	4 Dec 2004 14:28:16 -0000	1.3
  +++ menu.py	4 Dec 2004 14:49:07 -0000	1.4
  @@ -16,7 +16,7 @@
           self.ed_id = pyui.widgets.Edit("", 32, self.onButton)
   
           self.lbl_passwd = pyui.widgets.Label("йȣ")
  -        self.ed_passwd = pyui.widgets.Edit("", 32, self.onButton)
  +        self.ed_passwd = pyui.widgets.Password("", 32, self.onButton)
   
           self.button = pyui.widgets.Button("α", self.onButton)
           self.topPanel.setLayout(pyui.layouts.GridLayoutManager(2,2))
  
  
  


exman       04/12/04 23:49:07

  Modified:    pyui     widgets.py
  Log:
  Edit  onChar ̺Ʈ 
  
  Revision  Changes    Path
  1.8       +2 -1      simingostop2/pyui/widgets.py
  
  Index: widgets.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/widgets.py,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- widgets.py	4 Dec 2004 14:28:16 -0000	1.7
  +++ widgets.py	4 Dec 2004 14:49:07 -0000	1.8
  @@ -275,7 +275,7 @@
           self.resize(self.width, int(getTheme().defaultTextHeight*1.5))
           #print "Edit widget sized to", self.width, self.height
           self.registerEvent(pyui.locals.KEYDOWN, self._pyuiKeyDown)
  -        self.registerEvent(pyui.locals.CHAR, self._pyuiChar)
  +        #self.registerEvent(pyui.locals.CHAR, self._pyuiChar) # by exman
           self.registerEvent(pyui.locals.LMOUSEBUTTONDOWN, self._pyuiMouseDown)
           self.registerEvent(pyui.locals.LMOUSEBUTTONUP, self._pyuiMouseUp)
           self.registerEvent(pyui.locals.MOUSEMOVE, self._pyuiMouseMotion)
  @@ -445,6 +445,7 @@
           if event.key >= 32 and event.key < 128:
               # add regular text to the box
               self.text = self.text[:self.caretPos] + chr(event.key) + self.text[self.caretPos:]
  +            print self.text
               self.caretPos += 1
               self.selectPos = self.caretPos
               self.setDirty()
  
  
  


softon      04/12/05 00:33:24

  Modified:    .        menu.py
  Added:       .        mainnews.py
  Log:
  added to News
  
  Revision  Changes    Path
  1.5       +6 -1      simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- menu.py	4 Dec 2004 14:49:07 -0000	1.4
  +++ menu.py	4 Dec 2004 15:33:24 -0000	1.5
  @@ -43,12 +43,14 @@
           pyui.dialogs.Dialog.close(self)
           
   
  +import mainnews
  +
   class game:
       def __init__(self):
           # create gui objects
   
           self.btnLobby = pyui.widgets.BackgroundImageButton(188-7, 447-25, 156+6, 46+6, "data/menu_lobby.png", self.onLobby)
  -        self.btnNews = pyui.widgets.BackgroundImageButton(459-7, 447-25, 156+6, 46+6, "data/menu_news.png")
  +        self.btnNews = pyui.widgets.BackgroundImageButton(459-7, 447-25, 156+6, 46+6, "data/menu_news.png", self.onNews)
           self.btnCreds = pyui.widgets.BackgroundImageButton(56-7, 520-25, 156+6, 46+6, "data/menu_creds.png")
           self.btnSetup = pyui.widgets.BackgroundImageButton(322-7, 520-25, 156+6, 46+6, "data/menu_setup.png")
           self.btnQuit = pyui.widgets.BackgroundImageButton(585-7, 520-25, 156+6, 46+6, "data/menu_quit.png", self.onQuit)
  @@ -58,6 +60,9 @@
           snd.play("voice", "humphrey")
           snd.playmusic("lobby.ogg")
   
  +    def onNews(self, button):
  +        news = mainnews.MainNews()
  +
       def drawBack(self):
           renderer = pyui.desktop.getRenderer()
           renderer.setup2D()
  
  
  
  1.1                  simingostop2/mainnews.py
  
  Index: mainnews.py
  ===================================================================
  import pyui
  import xmlrpclib
  
  class MainNews:
      def __init__(self):
          self.newsFrame = pyui.widgets.Frame(10, 10, 400, 300, "News List")
          splitter = pyui.widgets.SplitterPanel(pyui.widgets.SplitterPanel.HORIZONTAL,
                                        pyui.widgets.SplitterPanel.PERCENTAGE,
                                        50)
          splitter.getSecondPanel().setLayout(pyui.layouts.GridLayoutManager(1,2))
          self.newsFrame.replacePanel(splitter)
          self.newsFrame.enableResize(0)
  
          self.newsList = pyui.widgets.ListBox(self.onChanged)
          self.newsList.resize(400, 150)
          
          self.newsView = pyui.widgets.Label('')
          self.newsView.resize(400, 150)
        
         
          s = xmlrpclib.Server('http://simin.h-9.net/NEWS/')
          self.data = s.news.summery()
        
          for item in self.data:
              self.newsList.addItem(item.get('title'), item.get('content'))
              
          splitter.getFirstPanel().addChild(self.newsList)
          splitter.getSecondPanel().addChild(self.newsView)
          self.newsFrame.pack()
      
      def onChanged(self, item):
          if item:
              self.newsView.setText(item.data)
              
              
  if __name__ == '__main__':       
      pyui.init(800,600,"2d")
      m = MainNews()
      pyui.run()
      pyui.quit()
  
  
  


softon      04/12/05 00:33:24

  Modified:    pyui     base.py
  Log:
  added to News
  
  Revision  Changes    Path
  1.2       +9 -4      simingostop2/pyui/base.py
  
  Index: base.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/base.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- base.py	4 Dec 2004 05:25:06 -0000	1.1
  +++ base.py	4 Dec 2004 15:33:24 -0000	1.2
  @@ -53,6 +53,7 @@
           getDesktop().registerWidget(self)
           self.popup = None
           self.tooltipText = ""
  +        self.bResize = 1
   
       def hit(self, pos):
           """Check for a hit using absolute coordinates.
  @@ -181,10 +182,14 @@
       def resize(self, w, h):
           """ resize absolute size of the widget
           """
  -        self.setDirty()
  -        self.width = w
  -        self.height = h
  -        self.calcSize()
  +        if self.bResize == 1 :
  +		        self.setDirty()
  +		        self.width = w
  +		        self.height = h
  +		        self.calcSize()
  +		        
  +    def enableResize(self, b):
  +		    self.bResize = b
   
       def registerEvent(self, eventType, handler):
           """Setup handler for an event
  
  
  


exman       04/12/05 00:46:39

  Modified:    pyui     widgets.py
  Log:
  Edit widget   Է  ϰ...
  
  Revision  Changes    Path
  1.9       +11 -4     simingostop2/pyui/widgets.py
  
  Index: widgets.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/widgets.py,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- widgets.py	4 Dec 2004 14:49:07 -0000	1.8
  +++ widgets.py	4 Dec 2004 15:46:39 -0000	1.9
  @@ -28,8 +28,8 @@
   import pyui
   
   from pyui.desktop import getDesktop, getTheme, getRenderer
  -
   from pyui.base import Base, Panel, Window
  +import sys
   
   class Label(Base):
       """Label object has a text label. uses default font if font is not specified.
  @@ -275,13 +275,14 @@
           self.resize(self.width, int(getTheme().defaultTextHeight*1.5))
           #print "Edit widget sized to", self.width, self.height
           self.registerEvent(pyui.locals.KEYDOWN, self._pyuiKeyDown)
  -        #self.registerEvent(pyui.locals.CHAR, self._pyuiChar) # by exman
  +        self.registerEvent(pyui.locals.CHAR, self._pyuiChar) 
           self.registerEvent(pyui.locals.LMOUSEBUTTONDOWN, self._pyuiMouseDown)
           self.registerEvent(pyui.locals.LMOUSEBUTTONUP, self._pyuiMouseUp)
           self.registerEvent(pyui.locals.MOUSEMOVE, self._pyuiMouseMotion)
           self.registerEvent(pyui.locals.CLICKED, self._pyuiClicked)
   
       def draw(self, renderer):
  +        print renderer.font.size(self.text), self.width, self.caretPos, self.selectPos
           getTheme().drawEdit(self.windowRect,self.text, self.hasFocus(), self.caretPos, self.selectPos) 
               
       def setText(self, text):
  @@ -441,16 +442,17 @@
               self.postEvent(pyui.locals.CLICKED)
               return 1
   
  +        """
           # handle key presses - these are really handled by onChar
           if event.key >= 32 and event.key < 128:
               # add regular text to the box
               self.text = self.text[:self.caretPos] + chr(event.key) + self.text[self.caretPos:]
  -            print self.text
               self.caretPos += 1
               self.selectPos = self.caretPos
               self.setDirty()
               
               return 1
  +        """
           
           return 0
   
  @@ -467,8 +469,13 @@
           if len(self.text) > self.max:
               return 1
   
  +
           # add regular text to the box
  -        self.text = self.text[:self.caretPos] + event.key + self.text[self.caretPos:]
  +        tmp = self.text[:self.caretPos] + event.key + self.text[self.caretPos:]
  +        if self.width<pyui.desktop.getRenderer().font.size(tmp)[0]:
  +            sys.stdout.write("Warning: large fontwidth\n")
  +            return 1
  +        self.text = tmp
           self.caretPos += 1
           self.selectPos = self.caretPos
           self.setDirty()
  
  
  


exman       04/12/05 00:51:40

  Modified:    pyui     widgets.py
  Log:
  
  
  Revision  Changes    Path
  1.10      +0 -1      simingostop2/pyui/widgets.py
  
  Index: widgets.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/widgets.py,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- widgets.py	4 Dec 2004 15:46:39 -0000	1.9
  +++ widgets.py	4 Dec 2004 15:51:40 -0000	1.10
  @@ -282,7 +282,6 @@
           self.registerEvent(pyui.locals.CLICKED, self._pyuiClicked)
   
       def draw(self, renderer):
  -        print renderer.font.size(self.text), self.width, self.caretPos, self.selectPos
           getTheme().drawEdit(self.windowRect,self.text, self.hasFocus(), self.caretPos, self.selectPos) 
               
       def setText(self, text):
  
  
  


softon      04/12/05 01:46:26

  Modified:    .        mainnews.py
  Log:
  multiline
  except u\a0
  
  Revision  Changes    Path
  1.2       +5 -3      simingostop2/mainnews.py
  
  Index: mainnews.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/mainnews.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mainnews.py	4 Dec 2004 15:33:24 -0000	1.1
  +++ mainnews.py	4 Dec 2004 16:46:26 -0000	1.2
  @@ -4,20 +4,22 @@
   class MainNews:
       def __init__(self):
           self.newsFrame = pyui.widgets.Frame(10, 10, 400, 300, "News List")
  +        
           splitter = pyui.widgets.SplitterPanel(pyui.widgets.SplitterPanel.HORIZONTAL,
                                         pyui.widgets.SplitterPanel.PERCENTAGE,
                                         50)
           splitter.getSecondPanel().setLayout(pyui.layouts.GridLayoutManager(1,2))
  +        
           self.newsFrame.replacePanel(splitter)
           self.newsFrame.enableResize(0)
   
           self.newsList = pyui.widgets.ListBox(self.onChanged)
           self.newsList.resize(400, 150)
           
  -        self.newsView = pyui.widgets.Label('')
  -        self.newsView.resize(400, 150)
  +        self.newsView = pyui.entry.Entry()
  +        self.newsView.setReadOnly(1)
  +        self.newsView.resize(400, 300)
         
  -       
           s = xmlrpclib.Server('http://simin.h-9.net/NEWS/')
           self.data = s.news.summery()
         
  
  
  


softon      04/12/05 01:46:26

  Modified:    pyui     entry.py
  Log:
  multiline
  except u\a0
  
  Revision  Changes    Path
  1.2       +13 -1     simingostop2/pyui/entry.py
  
  Index: entry.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/entry.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- entry.py	4 Dec 2004 05:25:07 -0000	1.1
  +++ entry.py	4 Dec 2004 16:46:26 -0000	1.2
  @@ -166,7 +166,17 @@
               
       def setText(self, text):
           """external function to set the text and move the caret to the start"""
  -        self.text = text
  +        self.text = ''
  +        letter = ''
  +        gap = pyui.desktop.getRenderer().font.size("")[0]
  +        for eachLetter in text:
  +            if eachLetter == u'\u00a0':
  +                continue
  +            letter = letter + eachLetter
  +            if (self.width - gap) < pyui.desktop.getRenderer().font.size(letter)[0]:
  +                self.text = self.text + letter + '\r\n'
  +                letter = ''
  +        self.text = self.text + letter
           self.caretPos = 0
           self.selectPos = self.caretPos
           self.scrollToCursor()
  @@ -379,6 +389,8 @@
       def _pyuiChar(self, event):
           """ARG! use CHAR messages for real characters.
           """
  +        if self.readonly:
  +            return 1
           if ord(event.key) < 32 or ord(event.key) > 128:
               return 1
           # add regular text to the box
  
  
  


softon      04/12/05 01:50:15

  Modified:    pyui     entry.py
  Log:
  first space is removed in Entry
  
  Revision  Changes    Path
  1.3       +2 -0      simingostop2/pyui/entry.py
  
  Index: entry.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/entry.py,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- entry.py	4 Dec 2004 16:46:26 -0000	1.2
  +++ entry.py	4 Dec 2004 16:50:15 -0000	1.3
  @@ -172,6 +172,8 @@
           for eachLetter in text:
               if eachLetter == u'\u00a0':
                   continue
  +            if letter == ' ':
  +                letter = ''
               letter = letter + eachLetter
               if (self.width - gap) < pyui.desktop.getRenderer().font.size(letter)[0]:
                   self.text = self.text + letter + '\r\n'
  
  
  


exman       04/12/05 02:21:48

  Modified:    .        menu.py
  Log:
  Password  **** ġ ʵ... and Login Dialog ̾ƿ 
  
  Revision  Changes    Path
  1.6       +9 -9      simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- menu.py	4 Dec 2004 15:33:24 -0000	1.5
  +++ menu.py	4 Dec 2004 17:21:48 -0000	1.6
  @@ -9,8 +9,8 @@
   class loginDialog(pyui.dialogs.Dialog):
       """Dialog to setup options for a trade route"""
       def __init__(self):
  -        pyui.dialogs.Dialog.__init__(self, 300, 250, 200, 120, "ùOnline::")
  -        self.setLayout(pyui.layouts.GridLayoutManager(1,2))
  +        pyui.dialogs.Dialog.__init__(self, 225, 250, 350, 140, "ùOnline::")
  +        self.setLayout(pyui.layouts.TableLayoutManager(15, 12))
           self.topPanel = pyui.widgets.Panel()
           self.lbl_id = pyui.widgets.Label("̵")
           self.ed_id = pyui.widgets.Edit("", 32, self.onButton)
  @@ -19,15 +19,15 @@
           self.ed_passwd = pyui.widgets.Password("", 32, self.onButton)
   
           self.button = pyui.widgets.Button("α", self.onButton)
  -        self.topPanel.setLayout(pyui.layouts.GridLayoutManager(2,2))
  -        self.topPanel.addChild(self.lbl_id)
  -        self.topPanel.addChild(self.ed_id)
  -        self.topPanel.addChild(self.lbl_passwd)
  -        self.topPanel.addChild(self.ed_passwd)
  +        self.topPanel.setLayout(pyui.layouts.TableLayoutManager(10, 2))
  +        self.topPanel.addChild(self.lbl_id, (0, 0, 1, 1))
  +        self.topPanel.addChild(self.ed_id, (2, 0, 8, 1))
  +        self.topPanel.addChild(self.lbl_passwd, (0, 1, 1, 1))
  +        self.topPanel.addChild(self.ed_passwd, (2, 1, 8, 1))
           self.topPanel.pack()
           
  -        self.addChild(self.topPanel)
  -        self.addChild(self.button)
  +        self.addChild(self.topPanel, (1, 1, 13, 6))
  +        self.addChild(self.button, (1, 8, 13, 3))
           self.pack()
           snd.play("voice", "welcomesimin%d" % random.randint(0, 3))
   
  
  
  


exman       04/12/05 02:21:48

  Modified:    pyui     widgets.py
  Log:
  Password  **** ġ ʵ... and Login Dialog ̾ƿ 
  
  Revision  Changes    Path
  1.11      +12 -2     simingostop2/pyui/widgets.py
  
  Index: widgets.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/widgets.py,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- widgets.py	4 Dec 2004 15:51:40 -0000	1.10
  +++ widgets.py	4 Dec 2004 17:21:48 -0000	1.11
  @@ -537,9 +537,19 @@
   
   class Password(Edit):
       widgetLabel = "Password"       
  +    def __init__(self,text, max, handler):
  +        Edit.__init__(self, text, max, handler)
  +        self.drawText = ""
  +
  +    def _pyuiKeyDown(self, event):
  +        ret = Edit._pyuiKeyDown(self, event)
  +        tmp = len(self.text) * "*"
  +        if self.width>=pyui.desktop.getRenderer().font.size(tmp)[0]:
  +            self.drawText = tmp
  +        return ret
       def draw(self, renderer):
  -        hidden = len(self.text) * "*"
  -        getTheme().drawEdit(self.windowRect, hidden, self.hasFocus(), self.caretPos, self.selectPos)        
  +        #hidden = len(self.text) * "*"
  +        getTheme().drawEdit(self.windowRect, self.drawText, self.hasFocus(), self.caretPos, self.selectPos)        
   
   
   class Scroll(Base):
  
  
  


softon      04/12/05 03:03:51

  Modified:    .        mainnews.py
  Log:
  bug fix : Entry mouse Event
  
  Revision  Changes    Path
  1.3       +5 -3      simingostop2/mainnews.py
  
  Index: mainnews.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/mainnews.py,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- mainnews.py	4 Dec 2004 16:46:26 -0000	1.2
  +++ mainnews.py	4 Dec 2004 18:03:51 -0000	1.3
  @@ -11,7 +11,6 @@
           splitter.getSecondPanel().setLayout(pyui.layouts.GridLayoutManager(1,2))
           
           self.newsFrame.replacePanel(splitter)
  -        self.newsFrame.enableResize(0)
   
           self.newsList = pyui.widgets.ListBox(self.onChanged)
           self.newsList.resize(400, 150)
  @@ -19,7 +18,7 @@
           self.newsView = pyui.entry.Entry()
           self.newsView.setReadOnly(1)
           self.newsView.resize(400, 300)
  -      
  +        
           s = xmlrpclib.Server('http://simin.h-9.net/NEWS/')
           self.data = s.news.summery()
         
  @@ -29,7 +28,10 @@
           splitter.getFirstPanel().addChild(self.newsList)
           splitter.getSecondPanel().addChild(self.newsView)
           self.newsFrame.pack()
  -    
  +        self.newsFrame.enableResize(0)
  +        self.newsList.enableResize(0)
  +        self.newsView.enableResize(0)
  +      
       def onChanged(self, item):
           if item:
               self.newsView.setText(item.data)
  
  
  


softon      04/12/05 03:03:51

  Modified:    pyui     base.py entry.py
  Log:
  bug fix : Entry mouse Event
  
  Revision  Changes    Path
  1.3       +8 -7      simingostop2/pyui/base.py
  
  Index: base.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/base.py,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- base.py	4 Dec 2004 15:33:24 -0000	1.2
  +++ base.py	4 Dec 2004 18:03:51 -0000	1.3
  @@ -104,9 +104,10 @@
           else:
               self.rect = (self.posX, self.posY, self.width, self.height)
               self.windowRect = (0, 0, self.width, self.height)
  -            
  +        
           for child in self.children:
               child.calcSize()
  +        
   
       def addChild(self, child):
           """Add a child widget.
  @@ -183,13 +184,13 @@
           """ resize absolute size of the widget
           """
           if self.bResize == 1 :
  -		        self.setDirty()
  -		        self.width = w
  -		        self.height = h
  -		        self.calcSize()
  -		        
  +            self.setDirty()
  +            self.width = w
  +            self.height = h
  +            self.calcSize()
  +            
       def enableResize(self, b):
  -		    self.bResize = b
  +        self.bResize = b
   
       def registerEvent(self, eventType, handler):
           """Setup handler for an event
  
  
  
  1.4       +21 -5     simingostop2/pyui/entry.py
  
  Index: entry.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/entry.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- entry.py	4 Dec 2004 16:50:15 -0000	1.3
  +++ entry.py	4 Dec 2004 18:03:51 -0000	1.4
  @@ -89,9 +89,9 @@
                   haveSelEnd = 0 <= ( selTo - i ) <= line_len
                   sx1, sx2 = 0, w
                   if haveSelStart:
  -                    sx1 = max( (selFrom - i - scroll[0]) * font_width, 0 )
  +                    sx1 = max( pyui.desktop.getRenderer().font.size(line[:selFrom - i - scroll[0]])[0], 0)
                   if haveSelEnd:
  -                    sx2 = (selTo - i - scroll[0]) * font_width
  +                    sx2 = pyui.desktop.getRenderer().font.size(line[:selTo - i - scroll[0]])[0]
                   elif not haveSelStart and ( 0 > ( selTo - i ) or ( selFrom - i ) > line_len ):
                       sx2 = -1
   
  @@ -100,7 +100,7 @@
   
                   # draw caret
                   if 0 <= ( caretPos - i ) <= line_len:
  -                    caret = (caretPos - i - scroll[0]) * font_width
  +                    caret = pyui.desktop.getRenderer().font.size(line[:caretPos - i - scroll[0]])[0]
                       if 0 <= caret <= w:
                           renderer.drawRect(getTheme().fgColor, (x+3+caret, y+3+ly, 1, font_heigth))
   
  @@ -202,10 +202,26 @@
           y = pos[1] - self.rect[1] - 5
           
           font_width, font_heigth = getRenderer().getTextSize( ' ', self.font )
  -        
  -        col = max( math.floor( (float(x) / float(font_width)) ) + self.scroll[0], 0 )
  +
  +        #col = max( math.floor( (float(x) / float(font_width)) ) + self.scroll[0], 0 )
           row = max( math.floor( (float(y) / float(font_heigth)) ) + self.scroll[1], 0 )
           
  +        line = self.text.split( '\n' )
  +        if len(line) <= int(row):
  +            line_len = len(line[-1])
  +            col = self.scroll[0] + len(line[-1])
  +        else:
  +            line_len = len(line[int(row)])
  +       
  +            if line_len == 0:
  +                col = self.scroll[0]
  +            else:
  +                col = self.scroll[0]
  +                for i in range(1,line_len):
  +                    if x > pyui.desktop.getRenderer().font.size(line[int(row)][:i])[0]:
  +                        col = i + self.scroll[0]
  +            
  +        
           r, c, i = 0, 0, 0
           while r != row:
               try: i = self.text.index( '\n', i ) + 1
  
  
  


krisna      04/12/05 03:39:20

  Modified:    pyui     widgets.py
  Log:
  Implement hangul input routine using libhang(pyhangul module)
  
  Revision  Changes    Path
  1.12      +82 -17    simingostop2/pyui/widgets.py
  
  Index: widgets.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/widgets.py,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- widgets.py	4 Dec 2004 17:21:48 -0000	1.11
  +++ widgets.py	4 Dec 2004 18:39:20 -0000	1.12
  @@ -30,6 +30,10 @@
   from pyui.desktop import getDesktop, getTheme, getRenderer
   from pyui.base import Base, Panel, Window
   import sys
  +try:
  +    import hangul
  +except:
  +    pass
   
   class Label(Base):
       """Label object has a text label. uses default font if font is not specified.
  @@ -272,6 +276,12 @@
           self.setText(text)        
           self.dragging = 0
           self.max = max
  +	try:
  +	    self.ic = hangul.create_ic(hangul.hangul2)
  +	except:
  +	    self.ic = None
  +	self.ic_compose = 0
  +	self.preedit_string = u''
           self.resize(self.width, int(getTheme().defaultTextHeight*1.5))
           #print "Edit widget sized to", self.width, self.height
           self.registerEvent(pyui.locals.KEYDOWN, self._pyuiKeyDown)
  @@ -282,7 +292,16 @@
           self.registerEvent(pyui.locals.CLICKED, self._pyuiClicked)
   
       def draw(self, renderer):
  -        getTheme().drawEdit(self.windowRect,self.text, self.hasFocus(), self.caretPos, self.selectPos) 
  +	text = self.text[:self.caretPos] + self.preedit_string + self.text[self.caretPos:]
  +	caretPos = self.caretPos + len(self.preedit_string)
  +        getTheme().drawEdit(self.windowRect, text, self.hasFocus(), caretPos, self.selectPos) 
  +
  +    # this method have to called before any non-char key event
  +    def reset(self):
  +	if self.ic:
  +	    self.ic.reset()
  +	    self.preedit_string = u''
  +	    self.insertText(self.ic.commit_string())
               
       def setText(self, text):
           """external function to set the text and move the caret to the end"""
  @@ -296,6 +315,16 @@
           self.selectPos = self.caretPos
           self.setDirty()
   
  +    def insertText(self, text):
  +	new_text = self.text[:self.caretPos] + text + self.text[self.caretPos:]
  +	if self.width < pyui.desktop.getRenderer().font.size(new_text)[0]:
  +	    sys.stdout.write("Warning: large fontwidth\n")
  +	    return
  +	self.text = new_text
  +	self.caretPos += len(text)
  +	self.selectPos = self.caretPos
  +	self.setDirty()
  +
       def loseFocus(self):
           Base.loseFocus(self)
           self.caretPos = 0
  @@ -327,6 +356,19 @@
                       break
                   r = c
           return l                
  +
  +    """ FIXME
  +    def handleEvent(self, event):
  +	if event.key == pyui.locals.K_SPACE and event.mods & pyui.locals.MOD_SHIFT:
  +	    if self.ic:
  +		if self.ic_compose:
  +		    # flush rest of preedit string
  +		    self.preedit_string = u''
  +		    self.ic.reset()
  +		    commit = self.ic.commit_string()
  +		self.ic_compose = not self.ic_compose
  +		return 1
  +	return Base.handleEvent(self, event) """
           
       def _pyuiMouseDown(self, event):
           if not self.hit(event.pos):
  @@ -378,6 +420,7 @@
               return 0
   
           if event.key == pyui.locals.K_LEFT:
  +	    self.reset()
               if self.caretPos > 0:
                   self.caretPos -= 1
               if (event.mods & pyui.locals.MOD_CONTROL):
  @@ -391,6 +434,7 @@
               return 1
   
           if event.key == pyui.locals.K_RIGHT:
  +	    self.reset()
               if self.caretPos < len(self.text):
                   self.caretPos += 1
               if (event.mods & pyui.locals.MOD_CONTROL):
  @@ -404,6 +448,7 @@
               return 1
   
           if event.key == pyui.locals.K_HOME:
  +	    self.reset()
               self.caretPos = 0
               if not (event.mods & pyui.locals.MOD_SHIFT):
                   self.selectPos = self.caretPos
  @@ -411,6 +456,7 @@
               return 1
   
           if event.key == pyui.locals.K_END:
  +	    self.reset()
               self.caretPos = len(self.text)
               if not (event.mods & pyui.locals.MOD_SHIFT):
                   self.selectPos = self.caretPos
  @@ -418,15 +464,21 @@
               return 1
   
           if event.key == pyui.locals.K_BACKSPACE:
  -            if self.selectPos != self.caretPos:
  -                self.deleteSelected()
  -            elif self.caretPos > 0:
  -                self.text = self.text[:self.caretPos-1] + self.text[self.caretPos:]
  -                self.caretPos -= 1
  -                self.selectPos = self.caretPos
  -            self.setDirty()
  +	    if len(self.preedit_string) > 0:
  +		if self.ic:
  +		    self.ic.backspace()
  +		    self.preedit_string = self.ic.preedit_string()
  +	    else:
  +		if self.selectPos != self.caretPos:
  +		    self.deleteSelected()
  +		elif self.caretPos > 0:
  +		    self.text = self.text[:self.caretPos-1] + self.text[self.caretPos:]
  +		    self.caretPos -= 1
  +		    self.selectPos = self.caretPos
  +	    self.setDirty()
               return 1
   
  +
           if event.key == pyui.locals.K_DELETE:
               if self.selectPos != self.caretPos:
                   self.deleteSelected()
  @@ -436,6 +488,16 @@
               self.setDirty()
               return 1
   
  +	if event.key == pyui.locals.K_SPACE and event.mods & pyui.locals.MOD_SHIFT:
  +	    if self.ic:
  +		if self.ic_compose:
  +		    # flush rest of preedit string
  +		    self.preedit_string = u''
  +		    self.ic.reset()
  +		    commit = self.ic.commit_string()
  +		self.ic_compose = not self.ic_compose
  +		return 1
  +
           if event.key == pyui.locals.K_RETURN:
               # invoke handler
               self.postEvent(pyui.locals.CLICKED)
  @@ -468,16 +530,19 @@
           if len(self.text) > self.max:
               return 1
   
  -
           # add regular text to the box
  -        tmp = self.text[:self.caretPos] + event.key + self.text[self.caretPos:]
  -        if self.width<pyui.desktop.getRenderer().font.size(tmp)[0]:
  -            sys.stdout.write("Warning: large fontwidth\n")
  -            return 1
  -        self.text = tmp
  -        self.caretPos += 1
  -        self.selectPos = self.caretPos
  -        self.setDirty()
  +	commit = u''
  +	if self.ic_compose:
  +	    if self.ic:
  +		ret = self.ic.filter(ord(event.key[0]), 0)
  +		self.preedit_string = self.ic.preedit_string()
  +		commit = self.ic.commit_string()
  +		if not ret:
  +		    commit += event.key
  +	else:
  +	    commit = event.key
  +
  +	self.insertText(commit)
           return 1
   
   class NumberEdit(Edit):
  
  
  


exman       04/12/05 03:52:24

  Modified:    .        menu.py
  Log:
  Messagebox ߰
  
  Revision  Changes    Path
  1.7       +34 -1     simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- menu.py	4 Dec 2004 17:21:48 -0000	1.6
  +++ menu.py	4 Dec 2004 18:52:24 -0000	1.7
  @@ -5,6 +5,27 @@
   from pyui import snd
   from pyui.base import *
   import random
  +from socket import *
  +
  +SOCK = None
  +
  +def callback(fd):
  +    print ""
  +
  +class MessageBox(pyui.dialogs.Dialog):
  +    def __init__(self, str):
  +        renderer = pyui.desktop.getRenderer()
  +        w, h = renderer.font.size(str)
  +        pyui.dialogs.Dialog.__init__(self, (800 - (w+10))/2, (600 - (h+50))/2, w+10, h+50, "ùOnline::")
  +        self.setLayout(pyui.layouts.GridLayoutManager(1, 2))
  +        self.message = pyui.widgets.Label(str)
  +        self.button = pyui.widgets.Button("Ȯ", self.onButton)
  +        self.addChild(self.message)
  +        self.addChild(self.button)
  +        self.pack()
  +        snd.play("sound", "ting")
  +    def onButton(self, button):
  +        self.close()
   
   class loginDialog(pyui.dialogs.Dialog):
       """Dialog to setup options for a trade route"""
  @@ -32,7 +53,18 @@
           snd.play("voice", "welcomesimin%d" % random.randint(0, 3))
   
       def onButton(self, button):
  -        print "haha"
  +        if SOCK!=None:
  +            mb = MessageBox("̹ α Դϴ. ø ٷ ּ.")
  +            mb.doModal()
  +            return 
  +        global SOCK
  +        SOCK = socket(AF_INET, SOCK_STREAM)
  +        try:
  +            SOCK.connect(('simin.h-9.net',1234))
  +        except:
  +            print "TT"
  +            return
  +        pyui.desktop.getRenderer().setSocketNotifier(SOCK.fileno(), callback)
   
       def close(self):
           self.topPanel = None
  @@ -60,6 +92,7 @@
           snd.play("voice", "humphrey")
           snd.playmusic("lobby.ogg")
   
  +
       def onNews(self, button):
           news = mainnews.MainNews()
   
  
  
  


exman       04/12/05 03:52:25

  Added:       data/sound ting.ogg
  Log:
  Messagebox ߰
  
  Revision  Changes    Path
  1.1                  simingostop2/data/sound/ting.ogg
  
  	<<Binary file>>
  
  


exman       04/12/05 03:52:25

  Modified:    pyui     rendererBase.py snd.py
  Log:
  Messagebox ߰
  
  Revision  Changes    Path
  1.4       +17 -0     simingostop2/pyui/rendererBase.py
  
  Index: rendererBase.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/rendererBase.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- rendererBase.py	4 Dec 2004 07:46:23 -0000	1.3
  +++ rendererBase.py	4 Dec 2004 18:52:25 -0000	1.4
  @@ -18,6 +18,7 @@
   
   from pyui.desktop import getDesktop
   import snd
  +import select
   
   class RendererBase:
       """Base class for renderers to implement. The renderer hands out window handles when windows
  @@ -40,6 +41,14 @@
           self.last = 0
           self.drawBackMethod = None
           self.drawBackArgs = []
  +        self.watchfds = []
  +        self.fdsCallback = {}
  +
  +    def setSocketNotifier(self, fd, callback=None):
  +        if fd not in self.watchfds:
  +            self.watchfds.append(fd)
  +        self.fdsCallback[fd] = callback
  +
   
       def getScreenSize(self):
           return (self.w, self.h)
  @@ -98,6 +107,14 @@
                   getDesktop().draw()
                   getDesktop().update()
   
  +                if len(self.watchfds)>0: # Socket Notifier by exman
  +                    r, w, o = select.select(self.watchfds, [], [], 0.01)
  +                    if r:
  +                        for fd in r:
  +                            self.fdsCallback[fd](fd)
  +
  +
  +
           snd.finish_playmusic() # by exman
   
       def setBackMethod(self, drawBackMethod, *args):
  
  
  
  1.3       +2 -2      simingostop2/pyui/snd.py
  
  Index: snd.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/snd.py,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- snd.py	4 Dec 2004 11:35:49 -0000	1.2
  +++ snd.py	4 Dec 2004 18:52:25 -0000	1.3
  @@ -58,8 +58,8 @@
   
   def fetch(type, name):
       if not sound_cache.has_key(name):
  -        if type=="audio":
  -            preloadaudio(name)
  +        if type=="sound":
  +            preloadsound(name)
           elif type=="voice":
               preloadvoice(name)
           elif type=="music":
  
  
  


exman       04/12/05 04:23:04

  Modified:    .        menu.py
  Added:       .        protocol.py
  Log:
  α, Ƽ ޾ƿ ߰,   ߰
  
  Revision  Changes    Path
  1.8       +83 -8     simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- menu.py	4 Dec 2004 18:52:24 -0000	1.7
  +++ menu.py	4 Dec 2004 19:23:04 -0000	1.8
  @@ -5,12 +5,72 @@
   from pyui import snd
   from pyui.base import *
   import random
  +import struct
  +import md5
  +import os
   from socket import *
  +from protocol import *
  +
  +sock = None
  +buffer = ""
  +
  +def event(major, minor, length, data):
  +    print major, minor, length
  +    global sock, buffer
  +    if major==M_LOBBY:
  +        if minor==RESPONSE_LOBBY_LOGIN:
  +            ret = struct.unpack("B", data[0])[0]
  +            if ret!=0x00:
  +                sock = None
  +                buffer = ""
  +                pyui.desktop.getRenderer().removeSocketNotifier()
  +                print "α : %d" % ret
  +                snd.play("voice", "loginfail")
  +                return
  +            ticket = data[1:]
  +            print "α ! ", ticket
  +            snd.play("voice", "loginsuccess%d" % random.randint(0, 1))
  +    
  +
  +def hexdump(buffer):
  +    i=0
  +    ret = ""
  +    for x in buffer:
  +        ret = ret + "%02X " % ord(x)
  +        i += 1
  +        if i%4==0:
  +            ret = ret+" "
  +        if i%16==0:
  +            ret = ret+"\n"
  +    print ret
  +
  +
  +def serverCallback(fd):
  +    global sock, buffer
  +    buf = os.read(fd, 1024)
  +    if buf=="":
  +        sock = None
  +        print "   "
  +        return
  +    buffer += buf
  +    hexdump(buffer)
  +    while True:
  +        if len(buffer)>=4:
  +            major, minor, length = \
  +                            struct.unpack('!BBH', buffer[:4])
  +            if len(buffer[4:])>=length:
  +                event(major, minor, length, \
  +                                        buffer[4:4+length])
  +                buffer = buffer[4+length:]
  +            else:
  +                break
  +        else:
  +            break
  +
  +
  +
   
  -SOCK = None
   
  -def callback(fd):
  -    print ""
   
   class MessageBox(pyui.dialogs.Dialog):
       def __init__(self, str):
  @@ -53,18 +113,33 @@
           snd.play("voice", "welcomesimin%d" % random.randint(0, 3))
   
       def onButton(self, button):
  -        if SOCK!=None:
  +        if sock!=None:
               mb = MessageBox("̹ α Դϴ. ø ٷ ּ.")
               mb.doModal()
               return 
  -        global SOCK
  -        SOCK = socket(AF_INET, SOCK_STREAM)
  +        id = self.ed_id.text
  +        passwd = self.ed_passwd.text
  +        if len(id.strip())==0 or len(passwd.strip())==0:
  +            mb = MessageBox("̵ о带  Է ּ.")
  +            mb.doModal()
  +            return 
  +
  +        global sock
  +        sock = socket(AF_INET, SOCK_STREAM)
           try:
  -            SOCK.connect(('simin.h-9.net',1234))
  +            sock.connect(('simin.h-9.net',1234))
           except:
               print "TT"
               return
  -        pyui.desktop.getRenderer().setSocketNotifier(SOCK.fileno(), callback)
  +
  +        passwd=md5.md5(passwd).hexdigest()
  +        pyui.desktop.getRenderer().setSocketNotifier(sock.fileno(), serverCallback)
  +
  +        sock.send(struct.pack("!BBH", M_LOBBY, REQUEST_LOBBY_LOGIN, len(id)+len(passwd)+2))
  +        sock.send(struct.pack("B", len(id)))
  +        sock.send(id)
  +        sock.send(struct.pack("B", len(passwd)))
  +        sock.send(passwd)
   
       def close(self):
           self.topPanel = None
  
  
  
  1.1                  simingostop2/protocol.py
  
  Index: protocol.py
  ===================================================================
  M_RESERVATION                               = 0x00
  M_LOBBY                                     = 0x01
  M_GAME_RESERVATION                          = 0x10
  M_GAME_GOSTOP                               = 0x11
  
  # Minor code in M_LOBBY
  # Request (0x00~0x4F) ============================
  REQUEST_LOBBY_VERSIONCHECK                   = 0x01
  REQUEST_LOBBY_LOGIN                          = 0x02
  REQUEST_LOBBY_CLIENTLIST                     = 0x03
  
  REQUEST_LOBBY_CREATE_GAMEROOM                = 0x11
  REQUEST_LOBBY_MODIFY_GAMEROOM                = 0x12
  REQUEST_LOBBY_DELETE_GAMEROOM                = 0x13
  
  REQUEST_LOBBY_JOIN_GAMEROOM                  = 0x14
  REQUEST_LOBBY_PART_RESERVATION_GAMEROOM      = 0x15
  REQUEST_LOBBY_PART_GAMEROOM                  = 0x16
  
  REQUEST_LOBBY_SENDMSG_CHAT                   = 0x21
  REQUEST_LOBBY_TOMSG_CHAT                     = 0x22
  
  # Response (0xA0~0xFF) ===========================
  RESPONSE_LOBBY_VERSIONCHECK                 = 0xA1
  RESPONSE_LOBBY_LOGIN                        = 0xA2
  RESPONSE_LOBBY_CLIENTLIST                   = 0xA3
  
  RESPONSE_LOBBY_CREATE_GAMEROOM              = 0xB1
  RESPONSE_LOBBY_MODIFY_GAMEROOM              = 0xB2
  RESPONSE_LOBBY_DELETE_GAMEROOM              = 0xB3
  
  RESPONSE_LOBBY_JOIN_GAMEROOM                = 0xB4
  RESPONSE_LOBBY_PART_RESERVATION_GAMEROOM    = 0xB5
  RESPONSE_LOBBY_PART_GAMEROOM                = 0xB6
  
  # Notificaton (0x50~0x9F) ========================
  NOTIFY_LOBBY_JOIN_CLIENT                    = 0x51
  NOTIFY_LOBBY_PART_CLIENT                    = 0x52
  
  NOTIFY_LOBBY_ADD_GAMEROOM                   = 0x61
  NOTIFY_LOBBY_MOD_GAMEROOM                   = 0x62
  NOTIFY_LOBBY_DEL_GAMEROOM                   = 0x63
  
  NOTIFY_LOBBY_JOIN_GAMEROOM                  = 0x64
  NOTIFY_LOBBY_PART_RESERVATION_GAMEROOM      = 0x65
  NOTIFY_LOBBY_PART_GAMEROOM                  = 0x66
  
  NOTIFY_LOBBY_RECVMSG_CHAT                   = 0x71
  NOTIFY_LOBBY_FROMMSG_CHAT                   = 0x72
  
  
  


exman       04/12/05 04:23:04

  Added:       data/voice loginfail.ogg loginsuccess0.ogg loginsuccess1.ogg
  Log:
  α, Ƽ ޾ƿ ߰,   ߰
  
  Revision  Changes    Path
  1.1                  simingostop2/data/voice/loginfail.ogg
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/data/voice/loginsuccess0.ogg
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/data/voice/loginsuccess1.ogg
  
  	<<Binary file>>
  
  


exman       04/12/05 04:23:04

  Modified:    pyui     rendererBase.py widgets.py
  Log:
  α, Ƽ ޾ƿ ߰,   ߰
  
  Revision  Changes    Path
  1.5       +3 -0      simingostop2/pyui/rendererBase.py
  
  Index: rendererBase.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/rendererBase.py,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- rendererBase.py	4 Dec 2004 18:52:25 -0000	1.4
  +++ rendererBase.py	4 Dec 2004 19:23:04 -0000	1.5
  @@ -48,6 +48,9 @@
           if fd not in self.watchfds:
               self.watchfds.append(fd)
           self.fdsCallback[fd] = callback
  +    def removeSocketNotifier(self):
  +        self.watchfds = []
  +        self.fdsCallback = {}
   
   
       def getScreenSize(self):
  
  
  
  1.13      +6 -0      simingostop2/pyui/widgets.py
  
  Index: widgets.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/widgets.py,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- widgets.py	4 Dec 2004 18:39:20 -0000	1.12
  +++ widgets.py	4 Dec 2004 19:23:04 -0000	1.13
  @@ -612,6 +612,12 @@
           if self.width>=pyui.desktop.getRenderer().font.size(tmp)[0]:
               self.drawText = tmp
           return ret
  +    def _pyuiChar(self, event):
  +        ret = Edit._pyuiChar(self, event)
  +        tmp = len(self.text) * "*"
  +        if self.width>=pyui.desktop.getRenderer().font.size(tmp)[0]:
  +            self.drawText = tmp
  +        return ret
       def draw(self, renderer):
           #hidden = len(self.text) * "*"
           getTheme().drawEdit(self.windowRect, self.drawText, self.hasFocus(), self.caretPos, self.selectPos)        
  
  
  


exman       04/12/05 05:02:33

  Modified:    .        menu.py
  Log:
  
  
  Revision  Changes    Path
  1.9       +1 -1      simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- menu.py	4 Dec 2004 19:23:04 -0000	1.8
  +++ menu.py	4 Dec 2004 20:02:33 -0000	1.9
  @@ -114,7 +114,7 @@
   
       def onButton(self, button):
           if sock!=None:
  -            mb = MessageBox("̹ α Դϴ. ø ٷ ּ.")
  +            mb = MessageBox("̹ α Դϴ.")
               mb.doModal()
               return 
           id = self.ed_id.text
  
  
  


softon      04/12/05 05:35:17

  Modified:    .        mainnews.py menu.py
  Log:
  add Creds
  
  Revision  Changes    Path
  1.4       +3 -3      simingostop2/mainnews.py
  
  Index: mainnews.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/mainnews.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- mainnews.py	4 Dec 2004 18:03:51 -0000	1.3
  +++ mainnews.py	4 Dec 2004 20:35:17 -0000	1.4
  @@ -3,7 +3,7 @@
   
   class MainNews:
       def __init__(self):
  -        self.newsFrame = pyui.widgets.Frame(10, 10, 400, 300, "News List")
  +        self.newsFrame = pyui.widgets.Frame(100, 75, 600, 450, "News List")
           
           splitter = pyui.widgets.SplitterPanel(pyui.widgets.SplitterPanel.HORIZONTAL,
                                         pyui.widgets.SplitterPanel.PERCENTAGE,
  @@ -13,11 +13,11 @@
           self.newsFrame.replacePanel(splitter)
   
           self.newsList = pyui.widgets.ListBox(self.onChanged)
  -        self.newsList.resize(400, 150)
  +        self.newsList.resize(600, 225)
           
           self.newsView = pyui.entry.Entry()
           self.newsView.setReadOnly(1)
  -        self.newsView.resize(400, 300)
  +        self.newsView.resize(600, 500)
           
           s = xmlrpclib.Server('http://simin.h-9.net/NEWS/')
           self.data = s.news.summery()
  
  
  
  1.10      +86 -3     simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- menu.py	4 Dec 2004 20:02:33 -0000	1.9
  +++ menu.py	4 Dec 2004 20:35:17 -0000	1.10
  @@ -10,6 +10,9 @@
   import os
   from socket import *
   from protocol import *
  +import pygame, os
  +from pygame.locals import *
  +from math import sin
   
   sock = None
   buffer = ""
  @@ -155,10 +158,10 @@
   class game:
       def __init__(self):
           # create gui objects
  -
  +        self.news = None
           self.btnLobby = pyui.widgets.BackgroundImageButton(188-7, 447-25, 156+6, 46+6, "data/menu_lobby.png", self.onLobby)
           self.btnNews = pyui.widgets.BackgroundImageButton(459-7, 447-25, 156+6, 46+6, "data/menu_news.png", self.onNews)
  -        self.btnCreds = pyui.widgets.BackgroundImageButton(56-7, 520-25, 156+6, 46+6, "data/menu_creds.png")
  +        self.btnCreds = pyui.widgets.BackgroundImageButton(56-7, 520-25, 156+6, 46+6, "data/menu_creds.png", self.onCreds)
           self.btnSetup = pyui.widgets.BackgroundImageButton(322-7, 520-25, 156+6, 46+6, "data/menu_setup.png")
           self.btnQuit = pyui.widgets.BackgroundImageButton(585-7, 520-25, 156+6, 46+6, "data/menu_quit.png", self.onQuit)
   
  @@ -169,7 +172,87 @@
   
   
       def onNews(self, button):
  -        news = mainnews.MainNews()
  +        if not self.news :
  +            self.news = mainnews.MainNews()
  +            
  +    def onCreds(self, button):
  +        screen = pyui.desktop.getRenderer().screen
  +        
  +        #load image
  +        imagename = os.path.join('data', 'creds.png')
  +        bitmap = pygame.image.load(imagename).convert()
  +
  +        #get the image and screen in the same format
  +        if screen.get_bitsize() == 8:
  +            screen.set_palette(bitmap.get_palette())
  +        else:
  +            bitmap = bitmap.convert()
  +
  +        bg = 0, 0, 0
  +
  +        #load font, prepare values
  +        font = pygame.font.Font("data/UnBom.ttf", 25)
  +        
  +        text = [
  +            ('Creds',''),
  +            ('', '(ggorro)'),
  +            ('Ʈ Ŵ', 'ö(exman)'),
  +            ('Web/DB ', 'ģ'),
  +            ('Ŭ̾Ʈ ', 'exman, , α(SoftOn)'),
  +            ('BGM ۰/', 'suup'),
  +            (' ', ', (nohmad)'),
  +            ('Protocol ۼ', 'Mithrandir'),
  +            ('ӿ ', '̹ö'),
  +            ('׷ ̳', 'ٲ'),
  +            ('ѱԷ ̺귯', 'ȯ(krisna)')
  +        ]
  +        fg = [
  +            ((250, 40, 230), (180, 50, 128)),
  +            ((54, 140, 230), (51, 245, 145)),
  +            ((150, 40, 230), (180, 130, 8)),
  +            ((125, 140, 230), (51, 10, 15)),
  +            ((50, 40, 230), (80, 250, 228)),
  +            ((76, 255, 230), (151, 145, 215)),
  +            ((198, 170, 230), (80, 140, 28)),
  +            ((125, 140, 132), (151, 245, 115)),
  +            ((250, 40, 120), (80, 10, 228)),
  +            ((125, 140, 240), (51, 145, 115)),
  +            ((250, 40, 130), (180, 150, 228))
  +        ]
  +        
  +        textImg = []
  +        size = []
  +        for i in range(len(text)):
  +            size.append(font.size(text[i][0]))
  +            ren1 = font.render(unicode(text[i][0], 'euc-kr'), 1, fg[i][0], bg)
  +            ren2 = font.render(unicode(text[i][1], 'euc-kr'), 1, fg[i][1], bg)
  +            ren1.set_colorkey(bg, pygame.RLEACCEL)
  +            ren2.set_colorkey(bg, pygame.RLEACCEL)
  +            textImg.append( (ren1, ren2) )
  +        
  +
  +        #prep some variables
  +        anim = 0.0
  +        leftGap = 50
  +        middleGap = 400
  + 
  +        #mainloop
  +        while not pygame.event.peek([QUIT, KEYDOWN, MOUSEBUTTONDOWN]):
  +            anim = anim + 0.05
  +            for x in range(0, 800, 20):
  +                for y in range(0, 600, 20):
  +                    xpos = (x + (sin(anim + x * .01) * 15)) + 20
  +                    ypos = (y + (sin(anim + y * .01) * 15)) + 20
  +                    screen.blit(bitmap, (x, y), (xpos, ypos, 20, 20))
  +           
  +            height = 0;
  +            for i in range(len(text)):
  +                height = height + size[i][1]
  +                screen.blit(textImg[i][0], (leftGap, height))
  +                screen.blit(textImg[i][1], (leftGap + middleGap, height))
  +            pygame.display.flip()
  +            
  +        self.drawBack()
   
       def drawBack(self):
           renderer = pyui.desktop.getRenderer()
  
  
  


softon      04/12/05 05:35:17

  Added:       data     creds.PNG
  Log:
  add Creds
  
  Revision  Changes    Path
  1.1                  simingostop2/data/creds.PNG
  
  	<<Binary file>>
  
  


exman       04/12/05 05:36:35

  Removed:     data     creds.PNG
  Log:
  


softon      04/12/05 06:07:21

  Modified:    .        menu.py
  Log:
  added to powed...
  
  Revision  Changes    Path
  1.11      +15 -0     simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- menu.py	4 Dec 2004 20:35:17 -0000	1.10
  +++ menu.py	4 Dec 2004 21:07:21 -0000	1.11
  @@ -250,6 +250,21 @@
                   height = height + size[i][1]
                   screen.blit(textImg[i][0], (leftGap, height))
                   screen.blit(textImg[i][1], (leftGap + middleGap, height))
  +                
  +            #powerd
  +            img = os.path.join('data', 'poweredpygame.gif')
  +            bmp = pygame.image.load(img).convert()
  +            screen.blit(bmp, (20, height+50))
  +            
  +            img = os.path.join('data', 'poweredpython.gif')
  +            bmp = pygame.image.load(img).convert()
  +            screen.blit(bmp, (280, height+80))
  +
  +            img = os.path.join('data', 'poweredsdl.png')
  +            bmp = pygame.image.load(img).convert()
  +            screen.blit(bmp, (400, height+60))
  +            
  +            time.sleep(0.01)
               pygame.display.flip()
               
           self.drawBack()
  
  
  


softon      04/12/05 06:07:21

  Added:       data     poweredpygame.gif poweredpython.gif poweredsdl.png
  Log:
  added to powed...
  
  Revision  Changes    Path
  1.1                  simingostop2/data/poweredpygame.gif
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/data/poweredpython.gif
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/data/poweredsdl.png
  
  	<<Binary file>>
  
  


exman       04/12/05 08:32:42

  Modified:    .        menu.py
  Added:       .        desktopmanager.py maincreds.py sockevt.py
  Log:
  desktopmanager ߰
  
  Revision  Changes    Path
  1.12      +145 -306  simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- menu.py	4 Dec 2004 21:07:21 -0000	1.11
  +++ menu.py	4 Dec 2004 23:32:42 -0000	1.12
  @@ -1,306 +1,145 @@
  -# -*- coding: euc-kr -*-
  -import time
  -import pyui
  -from pyui.locals import *
  -from pyui import snd
  -from pyui.base import *
  -import random
  -import struct
  -import md5
  -import os
  -from socket import *
  -from protocol import *
  -import pygame, os
  -from pygame.locals import *
  -from math import sin
  -
  -sock = None
  -buffer = ""
  -
  -def event(major, minor, length, data):
  -    print major, minor, length
  -    global sock, buffer
  -    if major==M_LOBBY:
  -        if minor==RESPONSE_LOBBY_LOGIN:
  -            ret = struct.unpack("B", data[0])[0]
  -            if ret!=0x00:
  -                sock = None
  -                buffer = ""
  -                pyui.desktop.getRenderer().removeSocketNotifier()
  -                print "α : %d" % ret
  -                snd.play("voice", "loginfail")
  -                return
  -            ticket = data[1:]
  -            print "α ! ", ticket
  -            snd.play("voice", "loginsuccess%d" % random.randint(0, 1))
  -    
  -
  -def hexdump(buffer):
  -    i=0
  -    ret = ""
  -    for x in buffer:
  -        ret = ret + "%02X " % ord(x)
  -        i += 1
  -        if i%4==0:
  -            ret = ret+" "
  -        if i%16==0:
  -            ret = ret+"\n"
  -    print ret
  -
  -
  -def serverCallback(fd):
  -    global sock, buffer
  -    buf = os.read(fd, 1024)
  -    if buf=="":
  -        sock = None
  -        print "   "
  -        return
  -    buffer += buf
  -    hexdump(buffer)
  -    while True:
  -        if len(buffer)>=4:
  -            major, minor, length = \
  -                            struct.unpack('!BBH', buffer[:4])
  -            if len(buffer[4:])>=length:
  -                event(major, minor, length, \
  -                                        buffer[4:4+length])
  -                buffer = buffer[4+length:]
  -            else:
  -                break
  -        else:
  -            break
  -
  -
  -
  -
  -
  -
  -class MessageBox(pyui.dialogs.Dialog):
  -    def __init__(self, str):
  -        renderer = pyui.desktop.getRenderer()
  -        w, h = renderer.font.size(str)
  -        pyui.dialogs.Dialog.__init__(self, (800 - (w+10))/2, (600 - (h+50))/2, w+10, h+50, "ùOnline::")
  -        self.setLayout(pyui.layouts.GridLayoutManager(1, 2))
  -        self.message = pyui.widgets.Label(str)
  -        self.button = pyui.widgets.Button("Ȯ", self.onButton)
  -        self.addChild(self.message)
  -        self.addChild(self.button)
  -        self.pack()
  -        snd.play("sound", "ting")
  -    def onButton(self, button):
  -        self.close()
  -
  -class loginDialog(pyui.dialogs.Dialog):
  -    """Dialog to setup options for a trade route"""
  -    def __init__(self):
  -        pyui.dialogs.Dialog.__init__(self, 225, 250, 350, 140, "ùOnline::")
  -        self.setLayout(pyui.layouts.TableLayoutManager(15, 12))
  -        self.topPanel = pyui.widgets.Panel()
  -        self.lbl_id = pyui.widgets.Label("̵")
  -        self.ed_id = pyui.widgets.Edit("", 32, self.onButton)
  -
  -        self.lbl_passwd = pyui.widgets.Label("йȣ")
  -        self.ed_passwd = pyui.widgets.Password("", 32, self.onButton)
  -
  -        self.button = pyui.widgets.Button("α", self.onButton)
  -        self.topPanel.setLayout(pyui.layouts.TableLayoutManager(10, 2))
  -        self.topPanel.addChild(self.lbl_id, (0, 0, 1, 1))
  -        self.topPanel.addChild(self.ed_id, (2, 0, 8, 1))
  -        self.topPanel.addChild(self.lbl_passwd, (0, 1, 1, 1))
  -        self.topPanel.addChild(self.ed_passwd, (2, 1, 8, 1))
  -        self.topPanel.pack()
  -        
  -        self.addChild(self.topPanel, (1, 1, 13, 6))
  -        self.addChild(self.button, (1, 8, 13, 3))
  -        self.pack()
  -        snd.play("voice", "welcomesimin%d" % random.randint(0, 3))
  -
  -    def onButton(self, button):
  -        if sock!=None:
  -            mb = MessageBox("̹ α Դϴ.")
  -            mb.doModal()
  -            return 
  -        id = self.ed_id.text
  -        passwd = self.ed_passwd.text
  -        if len(id.strip())==0 or len(passwd.strip())==0:
  -            mb = MessageBox("̵ о带  Է ּ.")
  -            mb.doModal()
  -            return 
  -
  -        global sock
  -        sock = socket(AF_INET, SOCK_STREAM)
  -        try:
  -            sock.connect(('simin.h-9.net',1234))
  -        except:
  -            print "TT"
  -            return
  -
  -        passwd=md5.md5(passwd).hexdigest()
  -        pyui.desktop.getRenderer().setSocketNotifier(sock.fileno(), serverCallback)
  -
  -        sock.send(struct.pack("!BBH", M_LOBBY, REQUEST_LOBBY_LOGIN, len(id)+len(passwd)+2))
  -        sock.send(struct.pack("B", len(id)))
  -        sock.send(id)
  -        sock.send(struct.pack("B", len(passwd)))
  -        sock.send(passwd)
  -
  -    def close(self):
  -        self.topPanel = None
  -        self.lbl_id = None
  -        self.lbl_passwd = None
  -        self.ed_id = None
  -        self.ed_passwd = None
  -        pyui.dialogs.Dialog.close(self)
  -        
  -
  -import mainnews
  -
  -class game:
  -    def __init__(self):
  -        # create gui objects
  -        self.news = None
  -        self.btnLobby = pyui.widgets.BackgroundImageButton(188-7, 447-25, 156+6, 46+6, "data/menu_lobby.png", self.onLobby)
  -        self.btnNews = pyui.widgets.BackgroundImageButton(459-7, 447-25, 156+6, 46+6, "data/menu_news.png", self.onNews)
  -        self.btnCreds = pyui.widgets.BackgroundImageButton(56-7, 520-25, 156+6, 46+6, "data/menu_creds.png", self.onCreds)
  -        self.btnSetup = pyui.widgets.BackgroundImageButton(322-7, 520-25, 156+6, 46+6, "data/menu_setup.png")
  -        self.btnQuit = pyui.widgets.BackgroundImageButton(585-7, 520-25, 156+6, 46+6, "data/menu_quit.png", self.onQuit)
  -
  -        pyui.desktop.getRenderer().setBackMethod(self.drawBack)
  -
  -        snd.play("voice", "humphrey")
  -        snd.playmusic("lobby.ogg")
  -
  -
  -    def onNews(self, button):
  -        if not self.news :
  -            self.news = mainnews.MainNews()
  -            
  -    def onCreds(self, button):
  -        screen = pyui.desktop.getRenderer().screen
  -        
  -        #load image
  -        imagename = os.path.join('data', 'creds.png')
  -        bitmap = pygame.image.load(imagename).convert()
  -
  -        #get the image and screen in the same format
  -        if screen.get_bitsize() == 8:
  -            screen.set_palette(bitmap.get_palette())
  -        else:
  -            bitmap = bitmap.convert()
  -
  -        bg = 0, 0, 0
  -
  -        #load font, prepare values
  -        font = pygame.font.Font("data/UnBom.ttf", 25)
  -        
  -        text = [
  -            ('Creds',''),
  -            ('', '(ggorro)'),
  -            ('Ʈ Ŵ', 'ö(exman)'),
  -            ('Web/DB ', 'ģ'),
  -            ('Ŭ̾Ʈ ', 'exman, , α(SoftOn)'),
  -            ('BGM ۰/', 'suup'),
  -            (' ', ', (nohmad)'),
  -            ('Protocol ۼ', 'Mithrandir'),
  -            ('ӿ ', '̹ö'),
  -            ('׷ ̳', 'ٲ'),
  -            ('ѱԷ ̺귯', 'ȯ(krisna)')
  -        ]
  -        fg = [
  -            ((250, 40, 230), (180, 50, 128)),
  -            ((54, 140, 230), (51, 245, 145)),
  -            ((150, 40, 230), (180, 130, 8)),
  -            ((125, 140, 230), (51, 10, 15)),
  -            ((50, 40, 230), (80, 250, 228)),
  -            ((76, 255, 230), (151, 145, 215)),
  -            ((198, 170, 230), (80, 140, 28)),
  -            ((125, 140, 132), (151, 245, 115)),
  -            ((250, 40, 120), (80, 10, 228)),
  -            ((125, 140, 240), (51, 145, 115)),
  -            ((250, 40, 130), (180, 150, 228))
  -        ]
  -        
  -        textImg = []
  -        size = []
  -        for i in range(len(text)):
  -            size.append(font.size(text[i][0]))
  -            ren1 = font.render(unicode(text[i][0], 'euc-kr'), 1, fg[i][0], bg)
  -            ren2 = font.render(unicode(text[i][1], 'euc-kr'), 1, fg[i][1], bg)
  -            ren1.set_colorkey(bg, pygame.RLEACCEL)
  -            ren2.set_colorkey(bg, pygame.RLEACCEL)
  -            textImg.append( (ren1, ren2) )
  -        
  -
  -        #prep some variables
  -        anim = 0.0
  -        leftGap = 50
  -        middleGap = 400
  - 
  -        #mainloop
  -        while not pygame.event.peek([QUIT, KEYDOWN, MOUSEBUTTONDOWN]):
  -            anim = anim + 0.05
  -            for x in range(0, 800, 20):
  -                for y in range(0, 600, 20):
  -                    xpos = (x + (sin(anim + x * .01) * 15)) + 20
  -                    ypos = (y + (sin(anim + y * .01) * 15)) + 20
  -                    screen.blit(bitmap, (x, y), (xpos, ypos, 20, 20))
  -           
  -            height = 0;
  -            for i in range(len(text)):
  -                height = height + size[i][1]
  -                screen.blit(textImg[i][0], (leftGap, height))
  -                screen.blit(textImg[i][1], (leftGap + middleGap, height))
  -                
  -            #powerd
  -            img = os.path.join('data', 'poweredpygame.gif')
  -            bmp = pygame.image.load(img).convert()
  -            screen.blit(bmp, (20, height+50))
  -            
  -            img = os.path.join('data', 'poweredpython.gif')
  -            bmp = pygame.image.load(img).convert()
  -            screen.blit(bmp, (280, height+80))
  -
  -            img = os.path.join('data', 'poweredsdl.png')
  -            bmp = pygame.image.load(img).convert()
  -            screen.blit(bmp, (400, height+60))
  -            
  -            time.sleep(0.01)
  -            pygame.display.flip()
  -            
  -        self.drawBack()
  -
  -    def drawBack(self):
  -        renderer = pyui.desktop.getRenderer()
  -        renderer.setup2D()
  -
  -        renderer.clear()
  -        renderer.drawImage((0,0,800,600), "data/background/menubg.png")
  -        renderer.teardown2D()
  -        """
  -        renderer.drawLine(x*80,1,x*80, 600, (0,255,255,255) )
  -
  -        renderer.drawRect( pyui.colors.red, (100,100,600,400) )            
  -
  -        """
  -        #pyui.desktop.getTheme().drawButton((100,100,100,60), "haha", True, 0, 1)
  -    def onLobby(self, button):
  -        self.td = loginDialog()
  -        self.td.doModal()
  -        
  -    def onQuit(self, button):
  -        pyui.desktop.getDesktop().quit()
  -        
  -    def onButton(self, button):
  -        print "Button pressed", button
  -        if self.console:
  -            self.console.destroy()
  -            self.console = None
  -            return 1
  -        else:
  -            self.console = pyui.dialogs.Console(30,300,500,300)
  -            return 1
  -
  -    def onInfoButton(self, button):
  -        pass
  -
  -
  +# -*- coding: euc-kr -*-
  +import time
  +import pyui
  +from pyui.locals import *
  +from pyui import snd
  +from pyui.base import *
  +
  +import random
  +import sockevt
  +from socket import *
  +import md5, struct
  +from protocol import *
  +import pygame, os
  +from pygame.locals import *
  +from math import sin
  +import desktopmanager
  +
  +
  +class MenuDesktop(desktopmanager.BaseDesktop):
  +    def __init__(self):
  +        desktopmanager.BaseDesktop.__init__(self)
  +        pyui.desktop.getRenderer().setBackMethod(self.drawBack)
  +        self.btnLobby = pyui.widgets.BackgroundImageButton(188-7, 447-25, 156+6, 46+6, "data/menu_lobby.png", self.onLobby)
  +        self.btnNews = pyui.widgets.BackgroundImageButton(459-7, 447-25, 156+6, 46+6, "data/menu_news.png", self.onNews)
  +        self.btnCreds = pyui.widgets.BackgroundImageButton(56-7, 520-25, 156+6, 46+6, "data/menu_creds.png", self.onCreds)
  +        self.btnSetup = pyui.widgets.BackgroundImageButton(322-7, 520-25, 156+6, 46+6, "data/menu_setup.png")
  +        self.btnQuit = pyui.widgets.BackgroundImageButton(585-7, 520-25, 156+6, 46+6, "data/menu_quit.png", self.onQuit)
  +
  +        self.news = None
  +    def show(self):
  +        self.btnLobby.show = 1
  +        self.btnNews.show = 1
  +        self.btnCreds.show = 1
  +        self.btnSetup.show = 1
  +        self.btnQuit.show = 1
  +        pyui.desktop.getRenderer().setBackMethod(self.drawBack)
  +
  +    def hide(self):
  +        self.btnLobby.show = 0
  +        self.btnNews.show = 0
  +        self.btnCreds.show = 0
  +        self.btnSetup.show = 0
  +        self.btnQuit.show = 0
  +
  +    def drawBack(self):
  +        renderer = pyui.desktop.getRenderer()
  +        renderer.setup2D()
  +
  +        renderer.clear()
  +        renderer.drawImage((0,0,800,600), "data/background/menubg.png")
  +        renderer.teardown2D()
  +        """
  +        renderer.drawLine(x*80,1,x*80, 600, (0,255,255,255) )
  +
  +        renderer.drawRect( pyui.colors.red, (100,100,600,400) )            
  +
  +        """
  +        #pyui.desktop.getTheme().drawButton((100,100,100,60), "haha", True, 0, 1)
  +    def onLobby(self, button):
  +        self.td = loginDialog()
  +        self.td.doModal()
  +        
  +    def onQuit(self, button):
  +        pyui.desktop.getDesktop().quit()
  +        
  +    def onNews(self, button):
  +        import mainnews
  +        if not self.news :
  +            self.news = mainnews.MainNews()
  +            
  +    def onCreds(self, button):
  +        import maincreds
  +        desktopmanager.setCurrentDesktop(maincreds.CredsDesktop())
  +
  +class loginDialog(pyui.dialogs.Dialog):
  +    """Dialog to setup options for a trade route"""
  +    def __init__(self):
  +        pyui.dialogs.Dialog.__init__(self, 225, 250, 350, 140, "ùOnline::")
  +        self.setLayout(pyui.layouts.TableLayoutManager(15, 12))
  +        self.topPanel = pyui.widgets.Panel()
  +        self.lbl_id = pyui.widgets.Label("̵")
  +        self.ed_id = pyui.widgets.Edit("", 32, self.onButton)
  +
  +        self.lbl_passwd = pyui.widgets.Label("йȣ")
  +        self.ed_passwd = pyui.widgets.Password("", 32, self.onButton)
  +
  +        self.button = pyui.widgets.Button("α", self.onButton)
  +        self.topPanel.setLayout(pyui.layouts.TableLayoutManager(10, 2))
  +        self.topPanel.addChild(self.lbl_id, (0, 0, 1, 1))
  +        self.topPanel.addChild(self.ed_id, (2, 0, 8, 1))
  +        self.topPanel.addChild(self.lbl_passwd, (0, 1, 1, 1))
  +        self.topPanel.addChild(self.ed_passwd, (2, 1, 8, 1))
  +        self.topPanel.pack()
  +        
  +        self.addChild(self.topPanel, (1, 1, 13, 6))
  +        self.addChild(self.button, (1, 8, 13, 3))
  +        self.pack()
  +        snd.play("voice", "welcomesimin%d" % random.randint(0, 3))
  +
  +
  +    def onButton(self, button):
  +        if sockevt.sock!=None:
  +            mb = MessageBox("Ȯ", "̹ α Դϴ.")
  +            mb.doModal()
  +            return 
  +        id = self.ed_id.text
  +        passwd = self.ed_passwd.text
  +        if len(id.strip())==0 or len(passwd.strip())==0:
  +            mb = MessageBox("Ȯ", "̵ о带  Է ּ.")
  +            mb.doModal()
  +            return 
  +
  +        sockevt.sock = socket(AF_INET, SOCK_STREAM)
  +        try:
  +            sockevt.sock.connect(('simin.h-9.net',1234))
  +        except:
  +            print "TT"
  +            return
  +
  +        passwd=md5.md5(passwd).hexdigest()
  +        pyui.desktop.getRenderer().setSocketNotifier(sockevt.sock.fileno(), sockevt.serverCallback)
  +
  +        sockevt.sock.send(struct.pack("!BBH", M_LOBBY, REQUEST_LOBBY_LOGIN, len(id)+len(passwd)+2))
  +        sockevt.sock.send(struct.pack("B", len(id)))
  +        sockevt.sock.send(id)
  +        sockevt.sock.send(struct.pack("B", len(passwd)))
  +        sockevt.sock.send(passwd)
  +
  +    def close(self):
  +        self.topPanel = None
  +        self.lbl_id = None
  +        self.lbl_passwd = None
  +        self.ed_id = None
  +        self.ed_passwd = None
  +        pyui.dialogs.Dialog.close(self)
  +        
  +
  +
  +class game:
  +    def __init__(self):
  +        # create gui objects
  +        desktopmanager.setCurrentDesktop(MenuDesktop())
  +        snd.play("voice", "humphrey")
  +        snd.playmusic("lobby.ogg")
  +
  
  
  
  1.1                  simingostop2/desktopmanager.py
  
  Index: desktopmanager.py
  ===================================================================
  # -*- coding: euc-kr -*-
  currentDesktop = None
  desktopStack = []
  
  def setCurrentDesktop(desktop):
      global currentDesktop, desktopStack
      if currentDesktop!=None:
          currentDesktop.hide()
      desktopStack.append(desktop)
      currentDesktop = desktop
  def setPreviousDesktop():
      global currentDesktop, desktopStack
      if len(desktopStack)>1:
          del desktopStack[-1]
      desktopStack[-1].show()
      currentDesktop = desktopStack[-1]
  
  class BaseDesktop:
      def __init__(self):
          pass
      def show(self):
          pass
      def hide(self):
          pass
  
  
  
  1.1                  simingostop2/maincreds.py
  
  Index: maincreds.py
  ===================================================================
  # -*- coding: euc-kr -*-
  import time
  import pyui
  from pyui.locals import *
  from pyui import snd
  from pyui.base import *
  
  import random
  import sockevt
  from socket import *
  import md5, struct
  from protocol import *
  import pygame, os
  from pygame.locals import *
  from math import sin
  import desktopmanager
  
  
  class CredsDesktop(desktopmanager.BaseDesktop):
      def __init__(self):
          desktopmanager.BaseDesktop.__init__(self)
          pyui.desktop.getRenderer().setBackMethod(self.drawBack)
          self.anim = 0.0
          pyui.desktop.getDesktop().registerHandler(LMOUSEBUTTONDOWN, self.onQuit)
          pyui.desktop.getDesktop().registerHandler(RMOUSEBUTTONDOWN, self.onQuit)
          pyui.desktop.getDesktop().registerHandler(KEYDOWN, self.onQuit)
  
      def onQuit(self, event):
          pyui.desktop.getDesktop().unregisterHandler(LMOUSEBUTTONDOWN)
          pyui.desktop.getDesktop().unregisterHandler(RMOUSEBUTTONDOWN)
          pyui.desktop.getDesktop().unregisterHandler(KEYDOWN)
          desktopmanager.setPreviousDesktop()
  
      def show(self):
          pyui.desktop.getRenderer().setBackMethod(self.drawBack)
  
      def hide(self):
          pass
  
      def drawBack(self):
          screen = pyui.desktop.getRenderer().screen
          
          #load image
          imagename = os.path.join('data', 'creds.png')
          bitmap = pygame.image.load(imagename).convert()
  
          #get the image and screen in the same format
          if screen.get_bitsize() == 8:
              screen.set_palette(bitmap.get_palette())
          else:
              bitmap = bitmap.convert()
  
          bg = 0, 0, 0
  
          #load font, prepare values
          font = pygame.font.Font("data/UnBom.ttf", 25)
          
          text = [
              ('Creds',''),
              ('', '(ggorro)'),
              ('Ʈ Ŵ', 'ö(exman)'),
              ('Web/DB ', 'ģ'),
              ('Ŭ̾Ʈ ', 'exman, , α(SoftOn)'),
              ('BGM ۰/', 'suup'),
              (' ', ', (nohmad)'),
              ('Protocol ۼ', 'Mithrandir'),
              ('ӿ ', '̹ö'),
              ('׷ ̳', 'ٲ'),
              ('ѱԷ ̺귯', 'ȯ(krisna)')
          ]
          fg = [
              ((250, 40, 230), (180, 50, 128)),
              ((54, 140, 230), (51, 245, 145)),
              ((150, 40, 230), (180, 130, 8)),
              ((125, 140, 230), (51, 10, 15)),
              ((50, 40, 230), (80, 250, 228)),
              ((76, 255, 230), (151, 145, 215)),
              ((198, 170, 230), (80, 140, 28)),
              ((125, 140, 132), (151, 245, 115)),
              ((250, 40, 120), (80, 10, 228)),
              ((125, 140, 240), (51, 145, 115)),
              ((250, 40, 130), (180, 150, 228))
          ]
          
          textImg = []
          size = []
          for i in range(len(text)):
              size.append(font.size(text[i][0]))
              ren1 = font.render(unicode(text[i][0], 'euc-kr'), 1, fg[i][0], bg)
              ren2 = font.render(unicode(text[i][1], 'euc-kr'), 1, fg[i][1], bg)
              ren1.set_colorkey(bg, pygame.RLEACCEL)
              ren2.set_colorkey(bg, pygame.RLEACCEL)
              textImg.append( (ren1, ren2) )
          
  
          #prep some variables
          leftGap = 50
          middleGap = 400
   
          #mainloop
          self.anim = self.anim + 0.05
          for x in range(0, 800, 20):
              for y in range(0, 600, 20):
                  xpos = (x + (sin(self.anim + x * .01) * 15)) + 20
                  ypos = (y + (sin(self.anim + y * .01) * 15)) + 20
                  screen.blit(bitmap, (x, y), (xpos, ypos, 20, 20))
         
          height = 0;
          for i in range(len(text)):
              height = height + size[i][1]
              screen.blit(textImg[i][0], (leftGap, height))
              screen.blit(textImg[i][1], (leftGap + middleGap, height))
  
  
  
  
  1.1                  simingostop2/sockevt.py
  
  Index: sockevt.py
  ===================================================================
  import time
  import pyui
  from pyui.locals import *
  from pyui import snd
  from pyui.base import *
  import struct
  import md5
  import os
  from socket import *
  from protocol import *
  import random
  
  sock = None
  buffer = ""
  
  def event(major, minor, length, data):
      print major, minor, length
      global sock, buffer
      if major==M_LOBBY:
          if minor==RESPONSE_LOBBY_LOGIN:
              ret = struct.unpack("B", data[0])[0]
              if ret!=0x00:
                  sock = None
                  buffer = ""
                  pyui.desktop.getRenderer().removeSocketNotifier()
                  print "α : %d" % ret
                  snd.play("voice", "loginfail")
                  return
              ticket = data[1:]
              print "α ! ", ticket
              snd.play("voice", "loginsuccess%d" % random.randint(0, 1))
      
  
  def hexdump(buffer):
      i=0
      ret = ""
      for x in buffer:
          ret = ret + "%02X " % ord(x)
          i += 1
          if i%4==0:
              ret = ret+" "
          if i%16==0:
              ret = ret+"\n"
      print ret
  
  
  def serverCallback(fd):
      global sock, buffer
      buf = os.read(fd, 1024)
      if buf=="":
          sock = None
          print "   "
          return
      buffer += buf
      hexdump(buffer)
      while True:
          if len(buffer)>=4:
              major, minor, length = \
                              struct.unpack('!BBH', buffer[:4])
              if len(buffer[4:])>=length:
                  event(major, minor, length, \
                                          buffer[4:4+length])
                  buffer = buffer[4+length:]
              else:
                  break
          else:
              break
  
  
  


exman       04/12/05 08:32:45

  Added:       data     creds.png
  Log:
  desktopmanager ߰
  
  Revision  Changes    Path
  1.1                  simingostop2/data/creds.png
  
  	<<Binary file>>
  
  


exman       04/12/05 08:32:45

  Modified:    pyui     desktop.py dialogs.py
  Log:
  desktopmanager ߰
  
  Revision  Changes    Path
  1.2       +8 -0      simingostop2/pyui/desktop.py
  
  Index: desktop.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/desktop.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- desktop.py	4 Dec 2004 05:25:06 -0000	1.1
  +++ desktop.py	4 Dec 2004 23:32:45 -0000	1.2
  @@ -205,6 +205,12 @@
           (public)
           """
           self.userHandlers[eventType] = handler
  +                                                                                
  +    def unregisterHandler(self, eventType):
  +        """Remove handler for an event
  +        """
  +        if self.userHandlers.has_key(eventType):
  +            del self.userHandlers[eventType]
   
   
       def readTimer(self):
  @@ -248,11 +254,13 @@
                   self.userHandlers[event.type](event)
                   return
   
  +            """
               # special event handlers
               if event.type == pyui.locals.KEYDOWN:
                   if event.key == pyui.locals.K_ESCAPE:  # escape
                       self.running = 0
                       return self.running
  +            """
   
       def updateToolTips(self, event):
           ##NOTE: turned off for now...
  
  
  
  1.2       +16 -0     simingostop2/pyui/dialogs.py
  
  Index: dialogs.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/dialogs.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- dialogs.py	4 Dec 2004 05:25:07 -0000	1.1
  +++ dialogs.py	4 Dec 2004 23:32:45 -0000	1.2
  @@ -25,6 +25,7 @@
   import pyui
   from pyui import locals
   from pyui.desktop import getDesktop, getRenderer, getTheme
  +import snd
   
   EVENT_OUTPUT = pyui.desktop.getUserEvent()
   
  @@ -662,3 +663,18 @@
           newColor.append(0) # this make setRGB not reset self.color
           apply(self.dialog.setRGB, newColor)
           return 1
  +
  +class MessageBox(Dialog):
  +    def __init__(self, title, str):
  +        renderer = pyui.desktop.getRenderer()
  +        w, h = renderer.font.size(str)
  +        Dialog.__init__(self, (800 - (w+10))/2, (600 - (h+50))/2, w+10, h+50, title)
  +        self.setLayout(pyui.layouts.GridLayoutManager(1, 2))
  +        self.message = pyui.widgets.Label(str)
  +        self.button = pyui.widgets.Button("Ȯ", self.onButton)
  +        self.addChild(self.message)
  +        self.addChild(self.button)
  +        self.pack()
  +        snd.play("sound", "ting")
  +    def onButton(self, button):
  +        self.close()
  
  
  


exman       04/12/05 08:47:23

  Modified:    data     creds.png
  Log:
  credit ̹ 
  
  Revision  Changes    Path
  1.2       +1862 -87  simingostop2/data/creds.png
  
  	<<Binary file>>
  
  


exman       04/12/05 09:04:40

  Modified:    .        menu.py
  Log:
  bye ̽ ߰
  
  Revision  Changes    Path
  1.13      +7 -5      simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- menu.py	4 Dec 2004 23:32:42 -0000	1.12
  +++ menu.py	5 Dec 2004 00:04:40 -0000	1.13
  @@ -26,7 +26,6 @@
           self.btnSetup = pyui.widgets.BackgroundImageButton(322-7, 520-25, 156+6, 46+6, "data/menu_setup.png")
           self.btnQuit = pyui.widgets.BackgroundImageButton(585-7, 520-25, 156+6, 46+6, "data/menu_quit.png", self.onQuit)
   
  -        self.news = None
       def show(self):
           self.btnLobby.show = 1
           self.btnNews.show = 1
  @@ -61,15 +60,18 @@
           self.td.doModal()
           
       def onQuit(self, button):
  +        snd.play("voice", "bye%d" % random.randint(0, 4))
  +        time.sleep(2)
           pyui.desktop.getDesktop().quit()
           
       def onNews(self, button):
           import mainnews
  -        if not self.news :
  -            self.news = mainnews.MainNews()
  +        snd.play("voice", "news")
  +        mainnews.MainNews()
               
       def onCreds(self, button):
           import maincreds
  +        snd.play("voice", "creds")
           desktopmanager.setCurrentDesktop(maincreds.CredsDesktop())
   
   class loginDialog(pyui.dialogs.Dialog):
  @@ -100,13 +102,13 @@
   
       def onButton(self, button):
           if sockevt.sock!=None:
  -            mb = MessageBox("Ȯ", "̹ α Դϴ.")
  +            mb = pyui.dialogs.MessageBox("Ȯ", "̹ α Դϴ.")
               mb.doModal()
               return 
           id = self.ed_id.text
           passwd = self.ed_passwd.text
           if len(id.strip())==0 or len(passwd.strip())==0:
  -            mb = MessageBox("Ȯ", "̵ о带  Է ּ.")
  +            mb = pyui.dialogs.MessageBox("Ȯ", "̵ о带  Է ּ.")
               mb.doModal()
               return 
   
  
  
  


exman       04/12/05 09:04:40

  Added:       data/voice bye0.ogg bye1.ogg bye2.ogg bye3.ogg creds.ogg
                        news.ogg
  Log:
  bye ̽ ߰
  
  Revision  Changes    Path
  1.1                  simingostop2/data/voice/bye0.ogg
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/data/voice/bye1.ogg
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/data/voice/bye2.ogg
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/data/voice/bye3.ogg
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/data/voice/creds.ogg
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/data/voice/news.ogg
  
  	<<Binary file>>
  
  


softon      04/12/05 09:19:12

  Modified:    .        Tag: 1 maincreds.py
  Log:
  
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2       +53 -34    simingostop2/maincreds.py
  
  Index: maincreds.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/maincreds.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- maincreds.py	4 Dec 2004 23:32:42 -0000	1.1
  +++ maincreds.py	5 Dec 2004 00:19:12 -0000	1.2
  @@ -24,6 +24,31 @@
           pyui.desktop.getDesktop().registerHandler(LMOUSEBUTTONDOWN, self.onQuit)
           pyui.desktop.getDesktop().registerHandler(RMOUSEBUTTONDOWN, self.onQuit)
           pyui.desktop.getDesktop().registerHandler(KEYDOWN, self.onQuit)
  +        self.text = [
  +            ('', '(ggorro)'),
  +            ('Ʈ Ŵ', 'ö(exman)'),
  +            ('Web/DB ', 'ģ'),
  +            ('Ŭ̾Ʈ ', 'exman, , α(SoftOn)'),
  +            ('BGM ۰/', 'suup'),
  +            (' ', ', (nohmad)'),
  +            ('Protocol ۼ', 'Mithrandir'),
  +            ('ӿ ', '̹ö'),
  +            ('׷ ̳', 'ٲ'),
  +            ('ѱԷ ̺귯', 'ȯ(krisna)')
  +        ]
  +        self.fg = [
  +            [[54, 140, 230], [51, 245, 145]],
  +            [[150, 40, 230], [180, 130, 8]],
  +            [[125, 140, 230], [51, 10, 15]],
  +            [[50, 40, 230], [80, 250, 228]],
  +            [[76, 255, 230], [151, 145, 215]],
  +            [[198, 170, 230], [80, 140, 28]],
  +            [[125, 140, 132], [151, 245, 115]],
  +            [[250, 40, 120], [80, 10, 228]],
  +            [[125, 140, 240], [51, 145, 115]],
  +            [[250, 40, 130], [180, 150, 228]]
  +        ]
  +        self.bfg = [1, 0, 1, 0, 1, 0]
   
       def onQuit(self, event):
           pyui.desktop.getDesktop().unregisterHandler(LMOUSEBUTTONDOWN)
  @@ -53,41 +78,23 @@
           bg = 0, 0, 0
   
           #load font, prepare values
  -        font = pygame.font.Font("data/UnBom.ttf", 25)
  -        
  -        text = [
  -            ('Creds',''),
  -            ('', '(ggorro)'),
  -            ('Ʈ Ŵ', 'ö(exman)'),
  -            ('Web/DB ', 'ģ'),
  -            ('Ŭ̾Ʈ ', 'exman, , α(SoftOn)'),
  -            ('BGM ۰/', 'suup'),
  -            (' ', ', (nohmad)'),
  -            ('Protocol ۼ', 'Mithrandir'),
  -            ('ӿ ', '̹ö'),
  -            ('׷ ̳', 'ٲ'),
  -            ('ѱԷ ̺귯', 'ȯ(krisna)')
  -        ]
  -        fg = [
  -            ((250, 40, 230), (180, 50, 128)),
  -            ((54, 140, 230), (51, 245, 145)),
  -            ((150, 40, 230), (180, 130, 8)),
  -            ((125, 140, 230), (51, 10, 15)),
  -            ((50, 40, 230), (80, 250, 228)),
  -            ((76, 255, 230), (151, 145, 215)),
  -            ((198, 170, 230), (80, 140, 28)),
  -            ((125, 140, 132), (151, 245, 115)),
  -            ((250, 40, 120), (80, 10, 228)),
  -            ((125, 140, 240), (51, 145, 115)),
  -            ((250, 40, 130), (180, 150, 228))
  -        ]
  +        font = pygame.font.Font("data/UnBom.ttf", 23)
           
  +        for i in range( len(self.fg) ):
  +            self.fg[i][0][0] = (self.fg[i][0][0] + 2) %256
  +            self.fg[i][0][1] = (self.fg[i][0][1] - 1) %256
  +            self.fg[i][0][2] = (self.fg[i][0][2] + 3) %256
  +            self.fg[i][1][0] = (self.fg[i][1][0] - 3) %256
  +            self.fg[i][1][1] = (self.fg[i][1][1] + 2) %256
  +            self.fg[i][1][2] = (self.fg[i][1][2] - 1) %256
  +            
  +            
           textImg = []
           size = []
  -        for i in range(len(text)):
  -            size.append(font.size(text[i][0]))
  -            ren1 = font.render(unicode(text[i][0], 'euc-kr'), 1, fg[i][0], bg)
  -            ren2 = font.render(unicode(text[i][1], 'euc-kr'), 1, fg[i][1], bg)
  +        for i in range(len(self.text)):
  +            size.append(font.size(self.text[i][0]))
  +            ren1 = font.render(unicode(self.text[i][0], 'euc-kr'), 1, self.fg[i][0], bg)
  +            ren2 = font.render(unicode(self.text[i][1], 'euc-kr'), 1, self.fg[i][1], bg)
               ren1.set_colorkey(bg, pygame.RLEACCEL)
               ren2.set_colorkey(bg, pygame.RLEACCEL)
               textImg.append( (ren1, ren2) )
  @@ -105,9 +112,21 @@
                   ypos = (y + (sin(self.anim + y * .01) * 15)) + 20
                   screen.blit(bitmap, (x, y), (xpos, ypos, 20, 20))
          
  -        height = 0;
  -        for i in range(len(text)):
  +        height = 60;
  +        for i in range(len(self.text)):
               height = height + size[i][1]
               screen.blit(textImg[i][0], (leftGap, height))
               screen.blit(textImg[i][1], (leftGap + middleGap, height))
   
  +        imagename = os.path.join('data', 'poweredpygame.gif')
  +        bitmap = pygame.image.load(imagename).convert()
  +        screen.blit( bitmap, (50, height+40))
  +        
  +        imagename = os.path.join('data', 'poweredpython.gif')
  +        bitmap = pygame.image.load(imagename).convert()
  +        screen.blit( bitmap, (300, height+70))
  +        
  +        imagename = os.path.join('data', 'poweredsdl.png')
  +        bitmap = pygame.image.load(imagename).convert()
  +        screen.blit( bitmap, (420, height+50))
  +       
  \ No newline at end of file
  
  
  


exman       04/12/05 12:28:27

  Modified:    .        mainnews.py menu.py protocol.py sockevt.py
  Log:
  α, Ͽ콺  ޾ƿ
  
  Revision  Changes    Path
  1.5       +2 -1      simingostop2/mainnews.py
  
  Index: mainnews.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/mainnews.py,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- mainnews.py	4 Dec 2004 20:35:17 -0000	1.4
  +++ mainnews.py	5 Dec 2004 03:28:27 -0000	1.5
  @@ -1,9 +1,10 @@
  +#! -*- coding: euc-kr -*-
   import pyui
   import xmlrpclib
   
   class MainNews:
       def __init__(self):
  -        self.newsFrame = pyui.widgets.Frame(100, 75, 600, 450, "News List")
  +        self.newsFrame = pyui.widgets.Frame(100, 75, 600, 450, " !!!")
           
           splitter = pyui.widgets.SplitterPanel(pyui.widgets.SplitterPanel.HORIZONTAL,
                                         pyui.widgets.SplitterPanel.PERCENTAGE,
  
  
  
  1.14      +39 -3     simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- menu.py	5 Dec 2004 00:04:40 -0000	1.13
  +++ menu.py	5 Dec 2004 03:28:27 -0000	1.14
  @@ -15,6 +15,29 @@
   from math import sin
   import desktopmanager
   
  +class houseDialog(pyui.dialogs.Dialog):
  +    def __init__(self, houseList):
  +        pyui.dialogs.Dialog.__init__(self, 225, 250, 350, 140, " Ͽ콺 ϼ.")
  +        self.setLayout(pyui.layouts.GridLayoutManager(1, 2))
  +
  +        self.listbox = pyui.widgets.ListBox()
  +        for i in range(len(houseList)):
  +            self.listbox.addItem(houseList[i][0], 0)
  +
  +        self.button = pyui.widgets.Button("Ͽ콺 ", self.onButton)
  +
  +        self.addChild(self.listbox)
  +        self.addChild(self.button)
  +        self.pack()
  +
  +    def onButton(self, button):
  +        self.close()
  +
  +    def close(self):
  +        self.listbox = None
  +        self.button = None
  +        pyui.dialogs.Dialog.close(self)
  +        
   
   class MenuDesktop(desktopmanager.BaseDesktop):
       def __init__(self):
  @@ -25,7 +48,21 @@
           self.btnCreds = pyui.widgets.BackgroundImageButton(56-7, 520-25, 156+6, 46+6, "data/menu_creds.png", self.onCreds)
           self.btnSetup = pyui.widgets.BackgroundImageButton(322-7, 520-25, 156+6, 46+6, "data/menu_setup.png")
           self.btnQuit = pyui.widgets.BackgroundImageButton(585-7, 520-25, 156+6, 46+6, "data/menu_quit.png", self.onQuit)
  -
  +        sockevt.connectEvent(sockevt.LOGIN_SUCCESS, self.onLoginSuccess)
  +        sockevt.connectEvent(sockevt.LOGIN_ALREADY, self.onLoginAlready)
  +        sockevt.connectEvent(sockevt.LOGIN_FAIL, self.onLoginFail)
  +        sockevt.connectEvent(sockevt.LOGIN_HOUSELIST, self.onLoginHouseList)
  +
  +    def onLoginSuccess(self, *args):
  +        self.td.close()
  +        snd.play("voice", "loginsuccess%d" % random.randint(0, 1))
  +    def onLoginAlready(self, *args):
  +        snd.play("voice", "loginfail")
  +    def onLoginFail(self, *args):
  +        snd.play("voice", "loginfail")
  +    def onLoginHouseList(self, *args):
  +        self.hd = houseDialog(args[0])
  +        self.hd.doModal()
       def show(self):
           self.btnLobby.show = 1
           self.btnNews.show = 1
  @@ -60,7 +97,7 @@
           self.td.doModal()
           
       def onQuit(self, button):
  -        snd.play("voice", "bye%d" % random.randint(0, 4))
  +        snd.play("voice", "bye%d" % random.randint(0, 3))
           time.sleep(2)
           pyui.desktop.getDesktop().quit()
           
  @@ -75,7 +112,6 @@
           desktopmanager.setCurrentDesktop(maincreds.CredsDesktop())
   
   class loginDialog(pyui.dialogs.Dialog):
  -    """Dialog to setup options for a trade route"""
       def __init__(self):
           pyui.dialogs.Dialog.__init__(self, 225, 250, 350, 140, "ùOnline::")
           self.setLayout(pyui.layouts.TableLayoutManager(15, 12))
  
  
  
  1.2       +5 -0      simingostop2/protocol.py
  
  Index: protocol.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/protocol.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- protocol.py	4 Dec 2004 19:23:04 -0000	1.1
  +++ protocol.py	5 Dec 2004 03:28:27 -0000	1.2
  @@ -1,5 +1,6 @@
   M_RESERVATION                               = 0x00
   M_LOBBY                                     = 0x01
  +M_HOUSE                                     = 0x03
   M_GAME_RESERVATION                          = 0x10
   M_GAME_GOSTOP                               = 0x11
   
  @@ -24,6 +25,7 @@
   RESPONSE_LOBBY_VERSIONCHECK                 = 0xA1
   RESPONSE_LOBBY_LOGIN                        = 0xA2
   RESPONSE_LOBBY_CLIENTLIST                   = 0xA3
  +RESPONSE_LOBBY_LOGINHOUSELIST               = 0xA4
   
   RESPONSE_LOBBY_CREATE_GAMEROOM              = 0xB1
   RESPONSE_LOBBY_MODIFY_GAMEROOM              = 0xB2
  @@ -47,3 +49,6 @@
   
   NOTIFY_LOBBY_RECVMSG_CHAT                   = 0x71
   NOTIFY_LOBBY_FROMMSG_CHAT                   = 0x72
  +#### HOUSE Protocol 
  +REQUEST_HOUSE_LOGIN                         = 0x81
  +RESPONSE_HOUSE_LOGIN                        = 0xC1
  
  
  
  1.2       +40 -5     simingostop2/sockevt.py
  
  Index: sockevt.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/sockevt.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- sockevt.py	4 Dec 2004 23:32:42 -0000	1.1
  +++ sockevt.py	5 Dec 2004 03:28:27 -0000	1.2
  @@ -13,22 +13,57 @@
   sock = None
   buffer = ""
   
  +LOGIN_SUCCESS = 0
  +LOGIN_ALREADY = 1
  +LOGIN_FAIL    = 2
  +LOGIN_HOUSELIST = 3
  +eventHandler = {}
  +
  +def connectEvent(type, callback):
  +    global eventHandler
  +    if eventHandler.has_key(type):
  +        eventHandler[type].append(callback)
  +    else:
  +        eventHandler[type] = [callback,]
  +def emit(type, *args):
  +    if eventHandler.has_key(type):
  +        for callback in eventHandler[type]:
  +            callback(*args)
  +    
   def event(major, minor, length, data):
       print major, minor, length
       global sock, buffer
       if major==M_LOBBY:
           if minor==RESPONSE_LOBBY_LOGIN:
               ret = struct.unpack("B", data[0])[0]
  -            if ret!=0x00:
  +            if ret==0x00:
  +                ticket = data[1:]
  +                print "α ! ", ticket
  +                emit(LOGIN_SUCCESS)
  +            elif ret==0x01:
                   sock = None
                   buffer = ""
                   pyui.desktop.getRenderer().removeSocketNotifier()
                   print "α : %d" % ret
                   snd.play("voice", "loginfail")
  -                return
  -            ticket = data[1:]
  -            print "α ! ", ticket
  -            snd.play("voice", "loginsuccess%d" % random.randint(0, 1))
  +                emit(LOGIN_FAIL)
  +            elif ret==0x02:
  +                sock = None
  +                buffer = ""
  +                pyui.desktop.getRenderer().removeSocketNotifier()
  +                print "̹ α : %d" % ret
  +                emit(LOGIN_ALREADY)
  +        elif minor==RESPONSE_LOBBY_LOGINHOUSELIST:
  +            count = struct.unpack("!H", data[:2])[0]
  +            p = 2
  +            list = []
  +            for x in range(count):
  +                l = struct.unpack("B", data[p])[0]; p+=1
  +                housename = data[p:p+l]; p+=l
  +                l = struct.unpack("B", data[p])[0]; p+=1
  +                houseinfo = data[p:p+l]; p+=l
  +                list.append((housename, houseinfo))
  +            emit(LOGIN_HOUSELIST, list)
       
   
   def hexdump(buffer):
  
  
  


exman       04/12/05 12:28:27

  Added:       data/background housebg.png
  Log:
  α, Ͽ콺  ޾ƿ
  
  Revision  Changes    Path
  1.1                  simingostop2/data/background/housebg.png
  
  	<<Binary file>>
  
  


exman       04/12/05 12:34:19

  Modified:    .        menu.py
  Log:
  
  
  Revision  Changes    Path
  1.15      +2 -0      simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- menu.py	5 Dec 2004 03:28:27 -0000	1.14
  +++ menu.py	5 Dec 2004 03:34:19 -0000	1.15
  @@ -60,6 +60,8 @@
           snd.play("voice", "loginfail")
       def onLoginFail(self, *args):
           snd.play("voice", "loginfail")
  +        mb = pyui.dialogs.MessageBox("Ȯ", "йȣ Ǵ ̵ Ȯϼ.")
  +        mb.doModal()
       def onLoginHouseList(self, *args):
           self.hd = houseDialog(args[0])
           self.hd.doModal()
  
  
  


softon      04/12/05 12:40:46

  Modified:    .        mainnews.py
  Added:       .        config.py
  Log:
  added to config(not complete)
  
  Revision  Changes    Path
  1.6       +4 -1      simingostop2/mainnews.py
  
  Index: mainnews.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/mainnews.py,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- mainnews.py	5 Dec 2004 03:28:27 -0000	1.5
  +++ mainnews.py	5 Dec 2004 03:40:46 -0000	1.6
  @@ -1,6 +1,7 @@
   #! -*- coding: euc-kr -*-
   import pyui
   import xmlrpclib
  +import config
   
   class MainNews:
       def __init__(self):
  @@ -23,8 +24,10 @@
           s = xmlrpclib.Server('http://simin.h-9.net/NEWS/')
           self.data = s.news.summery()
         
  +        i = len(self.data)
           for item in self.data:
  -            self.newsList.addItem(item.get('title'), item.get('content'))
  +            self.newsList.addItem('%d. %s'%(i, item.get('title')) , item.get('content'))
  +            i = i - 1
               
           splitter.getFirstPanel().addChild(self.newsList)
           splitter.getSecondPanel().addChild(self.newsView)
  
  
  
  1.1                  simingostop2/config.py
  
  Index: config.py
  ===================================================================
  import _winreg, sys
  import platform
  
  
  # values
  volumn = 1         #0 : effect sound
  music = 1          #0 : background sound
  keyboard_type = 2  #3 : 2bul 3bul
  news = []
  nPlatform = 0       # default : windows platform
  
  ##########################################
  #  platform
  if platform.system() == 'Microsoft Windows':
  #    nPlatform = 0
      nPlatform = 0
  else:
      nPlatform = 1
  
  ##########################################
  #  check current saved data
  def updatedata():
      if nPlatform == 0:
          openKey()
      else:
          pass
  
  ##########################################
  #       win32
  
  #open key
  def openKey(path):
      path = "Software\\SiminGostop\\" + path
      return _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, path)
  
  #read key
  def queryValue(key):
      return _winreg.QueryValue(key, "")
  
  #write value at key
  def setValue(path, value):
      path = _winreg.HKEY_CURRENT_USER + "Software\\SiminGostop\\" + path
      _winreg.SetValue(key, path, _winreg.REG_SZ, value)
  
  
  


krisna      04/12/05 15:23:38

  Modified:    pyui     widgets.py
  Log:
   * does not send CHAR event on control chars
   * ignore trigger keys on Edit::__pyuiChar
  
  Revision  Changes    Path
  1.14      +16 -14    simingostop2/pyui/widgets.py
  
  Index: widgets.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/widgets.py,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- widgets.py	4 Dec 2004 19:23:04 -0000	1.13
  +++ widgets.py	5 Dec 2004 06:23:38 -0000	1.14
  @@ -316,10 +316,14 @@
           self.setDirty()
   
       def insertText(self, text):
  +	if len(text) <= 0:
  +	    return
  +
   	new_text = self.text[:self.caretPos] + text + self.text[self.caretPos:]
   	if self.width < pyui.desktop.getRenderer().font.size(new_text)[0]:
   	    sys.stdout.write("Warning: large fontwidth\n")
   	    return
  +
   	self.text = new_text
   	self.caretPos += len(text)
   	self.selectPos = self.caretPos
  @@ -357,19 +361,13 @@
                   r = c
           return l                
   
  -    """ FIXME
  -    def handleEvent(self, event):
  +    def isTriggerKeys(self, event):
   	if event.key == pyui.locals.K_SPACE and event.mods & pyui.locals.MOD_SHIFT:
  -	    if self.ic:
  -		if self.ic_compose:
  -		    # flush rest of preedit string
  -		    self.preedit_string = u''
  -		    self.ic.reset()
  -		    commit = self.ic.commit_string()
  -		self.ic_compose = not self.ic_compose
  -		return 1
  -	return Base.handleEvent(self, event) """
  -        
  +	    return 1
  +	if event.key == ' ' and event.mods & pyui.locals.MOD_SHIFT:
  +	    return 1
  +	return 0
  +
       def _pyuiMouseDown(self, event):
           if not self.hit(event.pos):
               return 0
  @@ -488,13 +486,13 @@
               self.setDirty()
               return 1
   
  -	if event.key == pyui.locals.K_SPACE and event.mods & pyui.locals.MOD_SHIFT:
  +	if self.isTriggerKeys(event):
   	    if self.ic:
   		if self.ic_compose:
   		    # flush rest of preedit string
   		    self.preedit_string = u''
   		    self.ic.reset()
  -		    commit = self.ic.commit_string()
  +		    self.insertText(self.ic.commit_string())
   		self.ic_compose = not self.ic_compose
   		return 1
   
  @@ -530,6 +528,10 @@
           if len(self.text) > self.max:
               return 1
   
  +	# ignore trigger keys
  +	if self.isTriggerKeys(event):
  +	    return 1
  +
           # add regular text to the box
   	commit = u''
   	if self.ic_compose:
  
  
  


krisna      04/12/05 15:23:38

  Modified:    pyui/renderers pygame2D.py
  Log:
   * does not send CHAR event on control chars
   * ignore trigger keys on Edit::__pyuiChar
  
  Revision  Changes    Path
  1.4       +3 -2      simingostop2/pyui/renderers/pygame2D.py
  
  Index: pygame2D.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/renderers/pygame2D.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- pygame2D.py	4 Dec 2004 07:46:23 -0000	1.3
  +++ pygame2D.py	5 Dec 2004 06:23:38 -0000	1.4
  @@ -245,8 +245,9 @@
                   else:
                       code = event.key
                   getDesktop().postUserEvent(pyui.locals.KEYDOWN, 0, 0, code, pygame.key.get_mods())
  -                if code >= 32 and code < 128:
  -                    getDesktop().postUserEvent(pyui.locals.CHAR, 0, 0, character.encode(), pygame.key.get_mods())
  +		if not event.mod & (pygame.KMOD_ALT | pygame.KMOD_CTRL):
  +		    if code >= 32 and code < 127: # 128 is K_DELETE
  +			getDesktop().postUserEvent(pyui.locals.CHAR, 0, 0, character.encode(), pygame.key.get_mods())
   
               elif event.type == KEYUP:
                   code = event.key
  
  
  


exman       04/12/12 23:51:13

  Modified:    .        sockevt.py
  Log:
  for Windows: use the socket instead fd
  
  Revision  Changes    Path
  1.3       +1 -1      simingostop2/sockevt.py
  
  Index: sockevt.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/sockevt.py,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- sockevt.py	5 Dec 2004 03:28:27 -0000	1.2
  +++ sockevt.py	12 Dec 2004 14:51:13 -0000	1.3
  @@ -81,7 +81,7 @@
   
   def serverCallback(fd):
       global sock, buffer
  -    buf = os.read(fd, 1024)
  +    buf = sock.recv(1024) #  fd о ϳ...  socket fd Ҽ 
       if buf=="":
           sock = None
           print "   "
  
  
  


exman       04/12/12 23:51:13

  Modified:    pyui     rendererBase.py
  Log:
  for Windows: use the socket instead fd
  
  Revision  Changes    Path
  1.6       +1 -0      simingostop2/pyui/rendererBase.py
  
  Index: rendererBase.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/rendererBase.py,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- rendererBase.py	4 Dec 2004 19:23:04 -0000	1.5
  +++ rendererBase.py	12 Dec 2004 14:51:13 -0000	1.6
  @@ -15,6 +15,7 @@
   # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   
   import time
  +import os
   
   from pyui.desktop import getDesktop
   import snd
  
  
  


exman       04/12/16 19:43:35

  Modified:    data/music lobby.ogg
  Log:
  lobby.ogg  by suup
  
  Revision  Changes    Path
  1.2       +2763 -2525simingostop2/data/music/lobby.ogg
  
  	<<Binary file>>
  
  


suup        04/12/17 02:14:05

  Log:
  Status:
  
  Vendor Tag:	tcvs-vendor
  Release Tags:	tcvs-release
  
  No conflicts created by this import


suup        04/12/17 02:16:42

  Log:
  Status:
  
  Vendor Tag:	tcvs-vendor
  Release Tags:	tcvs-release
  
  No conflicts created by this import


suup        04/12/17 02:18:15

  Log:
  Status:
  
  Vendor Tag:	tcvs-vendor
  Release Tags:	tcvs-release
  
  No conflicts created by this import


suup        04/12/17 02:21:56

  Log:
  Status:
  
  Vendor Tag:	tcvs-vendor
  Release Tags:	tcvs-release
  
  No conflicts created by this import


suup        04/12/17 02:25:40

  Modified:    data/music lobby.ogg
  Log:
  brass ߰
  
  Revision  Changes    Path
  1.3       +2857 -2774simingostop2/data/music/lobby.ogg
  
  	<<Binary file>>
  
  


suup        04/12/17 02:48:11

  Log:
  Status:
  
  Vendor Tag:	tcvs-vendor
  Release Tags:	tcvs-release
  
  No conflicts created by this import


suup        04/12/17 03:00:51

  Log:
  Status:
  
  Vendor Tag:	tcvs-vendor
  Release Tags:	tcvs-release
  
  No conflicts created by this import


suup        04/12/17 21:09:55

  Log:
  Status:
  
  Vendor Tag:	tcvs-vendor
  Release Tags:	tcvs-release
  
  No conflicts created by this import


suup        04/12/17 21:11:03

  Log:
  Status:
  
  Vendor Tag:	tcvs-vendor
  Release Tags:	tcvs-release
  
  No conflicts created by this import


suup        04/12/17 21:12:32

  Log:
  Status:
  
  Vendor Tag:	tcvs-vendor
  Release Tags:	tcvs-release
  
  No conflicts created by this import


suup        04/12/17 21:14:10

  Log:
  Status:
  
  Vendor Tag:	tcvs-vendor
  Release Tags:	tcvs-release
  
  No conflicts created by this import


suup        04/12/17 21:15:46

  Log:
  Status:
  
  Vendor Tag:	tcvs-vendor
  Release Tags:	tcvs-release
  
  No conflicts created by this import


suup        04/12/17 21:19:20

  Modified:    data/music lobby.ogg
  Log:
  brass Ʈ !
  
  Revision  Changes    Path
  1.4       +2663 -2862simingostop2/data/music/lobby.ogg
  
  	<<Binary file>>
  
  


comfuture    05/02/19 01:56:07

  Modified:    .        menu.py
  Added:       .        mainconfig.py
  Log:
  config ȭ 
  
  Revision  Changes    Path
  1.16      +7 -3      simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- menu.py	5 Dec 2004 03:34:19 -0000	1.15
  +++ menu.py	18 Feb 2005 16:56:07 -0000	1.16
  @@ -46,7 +46,7 @@
           self.btnLobby = pyui.widgets.BackgroundImageButton(188-7, 447-25, 156+6, 46+6, "data/menu_lobby.png", self.onLobby)
           self.btnNews = pyui.widgets.BackgroundImageButton(459-7, 447-25, 156+6, 46+6, "data/menu_news.png", self.onNews)
           self.btnCreds = pyui.widgets.BackgroundImageButton(56-7, 520-25, 156+6, 46+6, "data/menu_creds.png", self.onCreds)
  -        self.btnSetup = pyui.widgets.BackgroundImageButton(322-7, 520-25, 156+6, 46+6, "data/menu_setup.png")
  +        self.btnSetup = pyui.widgets.BackgroundImageButton(322-7, 520-25, 156+6, 46+6, "data/menu_setup.png", self.onSetup)
           self.btnQuit = pyui.widgets.BackgroundImageButton(585-7, 520-25, 156+6, 46+6, "data/menu_quit.png", self.onQuit)
           sockevt.connectEvent(sockevt.LOGIN_SUCCESS, self.onLoginSuccess)
           sockevt.connectEvent(sockevt.LOGIN_ALREADY, self.onLoginAlready)
  @@ -113,6 +113,11 @@
           snd.play("voice", "creds")
           desktopmanager.setCurrentDesktop(maincreds.CredsDesktop())
   
  +    def onSetup(self, button):
  +        import mainconfig
  +        snd.play("voice", "config")
  +        desktopmanager.setCurrentDesktop(mainconfig.GameConfig())
  +
   class loginDialog(pyui.dialogs.Dialog):
       def __init__(self):
           pyui.dialogs.Dialog.__init__(self, 225, 250, 350, 140, "ùOnline::")
  @@ -181,5 +186,4 @@
           # create gui objects
           desktopmanager.setCurrentDesktop(MenuDesktop())
           snd.play("voice", "humphrey")
  -        snd.playmusic("lobby.ogg")
  -
  +        snd.playmusic("lobby.ogg")
  \ No newline at end of file
  
  
  
  1.1                  simingostop2/mainconfig.py
  
  Index: mainconfig.py
  ===================================================================
  # -*- coding: euc-kr -*-
  import time
  import pyui
  from pyui.locals import *
  from pyui import snd
  from pyui.base import *
  
  import random
  import sockevt
  from socket import *
  import md5, struct
  from protocol import *
  import pygame, os
  from pygame.locals import *
  from math import sin
  import desktopmanager
  
  class GameConfig(desktopmanager.BaseDesktop):
      def __init__(self):
          desktopmanager.BaseDesktop.__init__(self)
          pyui.desktop.getRenderer().setBackMethod(self.drawBack)
          self.btnQuit = pyui.widgets.BackgroundImageButton(585-7, 520-25, 156+6, 46+6, "data/menu_quit.png", self.onQuit)
  
      def onQuit(self, event):
          """
          pyui.desktop.getDesktop().unregisterHandler(LMOUSEBUTTONDOWN)
          pyui.desktop.getDesktop().unregisterHandler(RMOUSEBUTTONDOWN)
          pyui.desktop.getDesktop().unregisterHandler(KEYDOWN)
          """
          desktopmanager.setPreviousDesktop()
  
      def show(self):
          pyui.desktop.getRenderer().setBackMethod(self.drawBack)
  
      def hide(self):
          pass
  
      def drawBack(self):
          renderer = pyui.desktop.getRenderer()
          renderer.setup2D()
  
          renderer.clear()
          renderer.drawImage((0,0,800,600), "data/background/configbg.png")
          renderer.teardown2D()
  
  


comfuture    05/02/19 01:56:08

  Added:       data/background configbg.png
  Log:
  config ȭ 
  
  Revision  Changes    Path
  1.1                  simingostop2/data/background/configbg.png
  
  	<<Binary file>>
  
  


comfuture    05/02/19 01:56:08

  Added:       data/voice config.ogg
  Log:
  config ȭ 
  
  Revision  Changes    Path
  1.1                  simingostop2/data/voice/config.ogg
  
  	<<Binary file>>
  
  


exman       05/02/19 02:34:08

  Modified:    .        mainconfig.py
  Log:
  setup quit button fix
  
  Revision  Changes    Path
  1.2       +2 -1      simingostop2/mainconfig.py
  
  Index: mainconfig.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/mainconfig.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mainconfig.py	18 Feb 2005 16:56:07 -0000	1.1
  +++ mainconfig.py	18 Feb 2005 17:34:08 -0000	1.2
  @@ -28,6 +28,7 @@
           pyui.desktop.getDesktop().unregisterHandler(KEYDOWN)
           """
           desktopmanager.setPreviousDesktop()
  +        self.btnQuit.destroy()
   
       def show(self):
           pyui.desktop.getRenderer().setBackMethod(self.drawBack)
  @@ -41,4 +42,4 @@
   
           renderer.clear()
           renderer.drawImage((0,0,800,600), "data/background/configbg.png")
  -        renderer.teardown2D()
  \ No newline at end of file
  +        renderer.teardown2D()
  
  
  


comfuture    05/02/19 10:10:42

  Modified:    .        mainconfig.py menu.py
  Log:
  * ȯ漳UI üâ忡 ̾ε  
  
  Revision  Changes    Path
  1.3       +35 -35    simingostop2/mainconfig.py
  
  Index: mainconfig.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/mainconfig.py,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- mainconfig.py	18 Feb 2005 17:34:08 -0000	1.2
  +++ mainconfig.py	19 Feb 2005 01:10:42 -0000	1.3
  @@ -1,45 +1,45 @@
   # -*- coding: euc-kr -*-
  -import time
   import pyui
   from pyui.locals import *
   from pyui import snd
   from pyui.base import *
   
  -import random
  -import sockevt
  -from socket import *
  -import md5, struct
  -from protocol import *
  -import pygame, os
  +import pygame
   from pygame.locals import *
  -from math import sin
   import desktopmanager
   
  -class GameConfig(desktopmanager.BaseDesktop):
  +class ConfigEntry:
  +    def __init__(self,nickname, fullscreen, bgsound, fxsound):
  +        self.nickname = nickname
  +        self.fullscreen = fullscreen
  +        self.bgsound = bgsound
  +        self.fxsound = fxsound
  +
  +class GameConfig:
       def __init__(self):
  -        desktopmanager.BaseDesktop.__init__(self)
  -        pyui.desktop.getRenderer().setBackMethod(self.drawBack)
  -        self.btnQuit = pyui.widgets.BackgroundImageButton(585-7, 520-25, 156+6, 46+6, "data/menu_quit.png", self.onQuit)
  -
  -    def onQuit(self, event):
  -        """
  -        pyui.desktop.getDesktop().unregisterHandler(LMOUSEBUTTONDOWN)
  -        pyui.desktop.getDesktop().unregisterHandler(RMOUSEBUTTONDOWN)
  -        pyui.desktop.getDesktop().unregisterHandler(KEYDOWN)
  -        """
  -        desktopmanager.setPreviousDesktop()
  -        self.btnQuit.destroy()
  -
  -    def show(self):
  -        pyui.desktop.getRenderer().setBackMethod(self.drawBack)
  -
  -    def hide(self):
  -        pass
  -
  -    def drawBack(self):
  -        renderer = pyui.desktop.getRenderer()
  -        renderer.setup2D()
  -
  -        renderer.clear()
  -        renderer.drawImage((0,0,800,600), "data/background/configbg.png")
  -        renderer.teardown2D()
  +        self.configFrame = pyui.widgets.Frame(250, 150, 300, 150, "ȯ漳")
  +        self.btn_apply = pyui.widgets.Button("", self.onApply)
  +        self.btn_cancel = pyui.widgets.Button("", self.onCancel)
  +
  +        self.fields = [
  +          ("text", "nickname", "Nickname:", 1, ""),
  +          ("checkbox", "fullscreen", "Full Screen", 1, 0),
  +          ("checkbox", "bgsound", "Backgroud Music", 1, 0),
  +          ("checkbox", "fxsound", "FX Sound", 1, 0),
  +        ]
  +
  +        self.formPanel = pyui.widgets.FormPanel(self.fields)
  +        self.formPanel.setLayout(pyui.layouts.GridLayoutManager(2,5))
  +        prevdata = ConfigEntry("ģ".decode("cp949"),False,True,True) # data from config file
  +        self.formPanel.populate(prevdata)
  +        self.configFrame.replacePanel(self.formPanel)
  +        self.configFrame.addChild(self.btn_apply)
  +        self.configFrame.addChild(self.btn_cancel)
  +        self.configFrame.pack()
  +
  +    def onApply(self,button):
  +        self.configFrame = self.btn_apply = self.btn_cancel = None
  +        # TODO: write config
  +
  +    def onCancel(self,button):
  +        self.configFrame = self.btn_apply = self.btn_cancel = None
  \ No newline at end of file
  
  
  
  1.17      +1 -1      simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- menu.py	18 Feb 2005 16:56:07 -0000	1.16
  +++ menu.py	19 Feb 2005 01:10:42 -0000	1.17
  @@ -116,7 +116,7 @@
       def onSetup(self, button):
           import mainconfig
           snd.play("voice", "config")
  -        desktopmanager.setCurrentDesktop(mainconfig.GameConfig())
  +        mainconfig.GameConfig()
   
   class loginDialog(pyui.dialogs.Dialog):
       def __init__(self):
  
  
  


softon      05/02/19 16:56:04

  Modified:    .        mainnews.py menu.py
  Log:
  MainNew Dialog .  domodal
  
  Revision  Changes    Path
  1.7       +9 -17     simingostop2/mainnews.py
  
  Index: mainnews.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/mainnews.py,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- mainnews.py	5 Dec 2004 03:40:46 -0000	1.6
  +++ mainnews.py	19 Feb 2005 07:56:04 -0000	1.7
  @@ -3,23 +3,16 @@
   import xmlrpclib
   import config
   
  -class MainNews:
  +class MainNews(pyui.dialogs.Dialog):
       def __init__(self):
  -        self.newsFrame = pyui.widgets.Frame(100, 75, 600, 450, " !!!")
  -        
  -        splitter = pyui.widgets.SplitterPanel(pyui.widgets.SplitterPanel.HORIZONTAL,
  -                                      pyui.widgets.SplitterPanel.PERCENTAGE,
  -                                      50)
  -        splitter.getSecondPanel().setLayout(pyui.layouts.GridLayoutManager(1,2))
  -        
  -        self.newsFrame.replacePanel(splitter)
  +        pyui.dialogs.Dialog.__init__(self, 100, 75, 600, 450, " !!!")
   
  +        self.setLayout(pyui.layouts.GridLayoutManager(1, 2))
  +        
           self.newsList = pyui.widgets.ListBox(self.onChanged)
  -        self.newsList.resize(600, 225)
           
           self.newsView = pyui.entry.Entry()
           self.newsView.setReadOnly(1)
  -        self.newsView.resize(600, 500)
           
           s = xmlrpclib.Server('http://simin.h-9.net/NEWS/')
           self.data = s.news.summery()
  @@ -29,12 +22,10 @@
               self.newsList.addItem('%d. %s'%(i, item.get('title')) , item.get('content'))
               i = i - 1
               
  -        splitter.getFirstPanel().addChild(self.newsList)
  -        splitter.getSecondPanel().addChild(self.newsView)
  -        self.newsFrame.pack()
  -        self.newsFrame.enableResize(0)
  -        self.newsList.enableResize(0)
  -        self.newsView.enableResize(0)
  +        self.addChild(self.newsList)
  +        self.addChild(self.newsView)
  +        self.resize(600, 500)
  +        self.pack()
         
       def onChanged(self, item):
           if item:
  @@ -44,5 +35,6 @@
   if __name__ == '__main__':       
       pyui.init(800,600,"2d")
       m = MainNews()
  +    m.doModal()
       pyui.run()
       pyui.quit()
  
  
  
  1.18      +3 -2      simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- menu.py	19 Feb 2005 01:10:42 -0000	1.17
  +++ menu.py	19 Feb 2005 07:56:04 -0000	1.18
  @@ -106,8 +106,9 @@
       def onNews(self, button):
           import mainnews
           snd.play("voice", "news")
  -        mainnews.MainNews()
  -            
  +        news = mainnews.MainNews()
  +        news.doModal()
  +                    
       def onCreds(self, button):
           import maincreds
           snd.play("voice", "creds")
  
  
  


comfuture    05/02/19 23:39:06

  Added:       .        ConfigHandler.py
  Log:
  .ini   Ľ/
  
  Revision  Changes    Path
  1.1                  simingostop2/ConfigHandler.py
  
  Index: ConfigHandler.py
  ===================================================================
  import os
  from ConfigParser import ConfigParser
  
  class ConfigHandler:
  
      def __init__(self):
          self.cp = ConfigParser()
          self.positive_values = ["On","Yes","True","1"]
          self.negative_values = ["Off","No","False","0"]
  
      def create(self,filename):
      	self.filename = filename
          f = open(filename,'w') or f.close()
  
      def load(self,filename):
          if not os.path.isfile(filename):
              return self.create(filename)
  
          self.cp.read(filename)
          self.filename = filename
          self.data = {}
          for sec in self.cp.sections():
              name = sec.lower()
              self.data[name] = {}
              for opt_key in self.cp.options(sec):
                  _value = self.cp.get(sec, opt_key)
                  if sec == 'options':
                      if _value in self.positive_values:
                          self.data[name][opt_key] = True
                      elif _value in self.negative_values:
                          self.data[name][opt_key] = False
                      else:
                          self.data[name][opt_key] = _value
                  else:
                      self.data[name][opt_key] = self.cp.get(sec, opt_key)
  
      def flatdata(self):
          ret = {}
          for sec in self.data.keys():
              if sec not in self.cp.sections():
                  self.cp.add_section(sec)
              for opt_key in self.data[sec].keys():
                  ret[opt_key] = self.data[sec][opt_key]
          print ret
  
      def setdata(self, data):
          self.data = data
  
      def save(self):
          for sec in self.data.keys():
              if sec not in self.cp.sections():
                  self.cp.add_section(sec)
              for opt_key in self.data[sec].keys():
                  self.cp.set(sec, opt_key, data[sec][opt_key])
          f = open(self.filename,'w')
          self.cp.write(f)
          f.close()
  
  if __name__ == '__main__':
      ch = ConfigHandler()
      ch.load('test.ini') # creates file if not exists
      print ch.flatdata() # ignore all section identifier
      data = {
          'global': {
              'nickname' : 'maroo'
          },
          'options' : {
              'fullscreen' : False,
              'bgsound' : True,
              'fxsound' : True
          }
      }
      ch.setdata(data)
      ch.save()
  
  
  


exman       05/02/20 00:37:46

  Modified:    .        config.py menu.py
  Log:
  menu ȭ ü
  
  Revision  Changes    Path
  1.2       +1 -1      simingostop2/config.py
  
  Index: config.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/config.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- config.py	5 Dec 2004 03:40:46 -0000	1.1
  +++ config.py	19 Feb 2005 15:37:46 -0000	1.2
  @@ -1,4 +1,4 @@
  -import _winreg, sys
  +#import _winreg, sys
   import platform
   
   
  
  
  
  1.19      +6 -6      simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- menu.py	19 Feb 2005 07:56:04 -0000	1.18
  +++ menu.py	19 Feb 2005 15:37:46 -0000	1.19
  @@ -43,11 +43,11 @@
       def __init__(self):
           desktopmanager.BaseDesktop.__init__(self)
           pyui.desktop.getRenderer().setBackMethod(self.drawBack)
  -        self.btnLobby = pyui.widgets.BackgroundImageButton(188-7, 447-25, 156+6, 46+6, "data/menu_lobby.png", self.onLobby)
  -        self.btnNews = pyui.widgets.BackgroundImageButton(459-7, 447-25, 156+6, 46+6, "data/menu_news.png", self.onNews)
  -        self.btnCreds = pyui.widgets.BackgroundImageButton(56-7, 520-25, 156+6, 46+6, "data/menu_creds.png", self.onCreds)
  -        self.btnSetup = pyui.widgets.BackgroundImageButton(322-7, 520-25, 156+6, 46+6, "data/menu_setup.png", self.onSetup)
  -        self.btnQuit = pyui.widgets.BackgroundImageButton(585-7, 520-25, 156+6, 46+6, "data/menu_quit.png", self.onQuit)
  +        self.btnLobby = pyui.widgets.BackgroundImageButton(70, 410, 130, 49, "data/menu_lobby.png", self.onLobby)
  +        self.btnNews = pyui.widgets.BackgroundImageButton(360, 440, 130, 49, "data/menu_news.png", self.onNews)
  +        self.btnCreds = pyui.widgets.BackgroundImageButton(605, 410, 130, 49, "data/menu_creds.png", self.onCreds)
  +        self.btnSetup = pyui.widgets.BackgroundImageButton(210, 490, 130, 49, "data/menu_setup.png", self.onSetup)
  +        self.btnQuit = pyui.widgets.BackgroundImageButton(510, 500, 130, 49, "data/menu_quit.png", self.onQuit)
           sockevt.connectEvent(sockevt.LOGIN_SUCCESS, self.onLoginSuccess)
           sockevt.connectEvent(sockevt.LOGIN_ALREADY, self.onLoginAlready)
           sockevt.connectEvent(sockevt.LOGIN_FAIL, self.onLoginFail)
  @@ -187,4 +187,4 @@
           # create gui objects
           desktopmanager.setCurrentDesktop(MenuDesktop())
           snd.play("voice", "humphrey")
  -        snd.playmusic("lobby.ogg")
  \ No newline at end of file
  +        snd.playmusic("lobby.ogg")
  
  
  


exman       05/02/20 00:37:46

  Modified:    data     menu_creds.png menu_lobby.png menu_news.png
                        menu_quit.png menu_setup.png
  Log:
  menu ȭ ü
  
  Revision  Changes    Path
  1.2       +20 -22    simingostop2/data/menu_creds.png
  
  	<<Binary file>>
  
  
  1.2       +38 -40    simingostop2/data/menu_lobby.png
  
  	<<Binary file>>
  
  
  1.2       +32 -26    simingostop2/data/menu_news.png
  
  	<<Binary file>>
  
  
  1.2       +45 -39    simingostop2/data/menu_quit.png
  
  	<<Binary file>>
  
  
  1.2       +28 -25    simingostop2/data/menu_setup.png
  
  	<<Binary file>>
  
  


exman       05/02/20 00:37:46

  Modified:    data/background menubg.png
  Log:
  menu ȭ ü
  
  Revision  Changes    Path
  1.2       +812 -531  simingostop2/data/background/menubg.png
  
  	<<Binary file>>
  
  


comfuture    05/02/20 00:57:40

  Modified:    .        ConfigHandler.py mainconfig.py
  Log:
   б
  
  Revision  Changes    Path
  1.2       +2 -1      simingostop2/ConfigHandler.py
  
  Index: ConfigHandler.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/ConfigHandler.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConfigHandler.py	19 Feb 2005 14:39:06 -0000	1.1
  +++ ConfigHandler.py	19 Feb 2005 15:57:40 -0000	1.2
  @@ -11,6 +11,7 @@
       def create(self,filename):
       	self.filename = filename
           f = open(filename,'w') or f.close()
  +        self.data = {}
   
       def load(self,filename):
           if not os.path.isfile(filename):
  @@ -41,7 +42,7 @@
                   self.cp.add_section(sec)
               for opt_key in self.data[sec].keys():
                   ret[opt_key] = self.data[sec][opt_key]
  -        print ret
  +        return ret
   
       def setdata(self, data):
           self.data = data
  
  
  
  1.4       +26 -10    simingostop2/mainconfig.py
  
  Index: mainconfig.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/mainconfig.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- mainconfig.py	19 Feb 2005 01:10:42 -0000	1.3
  +++ mainconfig.py	19 Feb 2005 15:57:40 -0000	1.4
  @@ -7,13 +7,8 @@
   import pygame
   from pygame.locals import *
   import desktopmanager
  -
  -class ConfigEntry:
  -    def __init__(self,nickname, fullscreen, bgsound, fxsound):
  -        self.nickname = nickname
  -        self.fullscreen = fullscreen
  -        self.bgsound = bgsound
  -        self.fxsound = fxsound
  +from ConfigHandler import ConfigHandler
  +import os
   
   class GameConfig:
       def __init__(self):
  @@ -30,7 +25,19 @@
   
           self.formPanel = pyui.widgets.FormPanel(self.fields)
           self.formPanel.setLayout(pyui.layouts.GridLayoutManager(2,5))
  -        prevdata = ConfigEntry("ģ".decode("cp949"),False,True,True) # data from config file
  +
  +        positive_values = ["On","Yes","True","1"]
  +        negative_values = ["Off","No","False","0"]
  +
  +        if os.sys.platform == 'win32':
  +            userdata_dir = '%s%s.simin' % (os.getenv('USERPROFILE'),os.sep)
  +        else:
  +            userdata_dir = '%s%s.simin' % (os.getenv('HOME'),os.sep)
  +        self.cfg_file = "%s%ssetting.ini" % (userdata_dir,os.sep)
  +
  +        ch = ConfigHandler()
  +        ch.load(self.cfg_file)
  +        prevdata = FakeAttrDict(ch.flatdata())
           self.formPanel.populate(prevdata)
           self.configFrame.replacePanel(self.formPanel)
           self.configFrame.addChild(self.btn_apply)
  @@ -38,8 +45,17 @@
           self.configFrame.pack()
   
       def onApply(self,button):
  -        self.configFrame = self.btn_apply = self.btn_cancel = None
           # TODO: write config
  +        self.configFrame.destroy()
   
       def onCancel(self,button):
  -        self.configFrame = self.btn_apply = self.btn_cancel = None
  \ No newline at end of file
  +        self.configFrame.destroy()
  +
  +class FakeAttrDict(dict):
  +    def __getattribute__(self, key):
  +        if key == '__dict__':
  +            return self
  +        try:
  +            return dict.__getattribute__(self, key)
  +        except:
  +            return ''
  
  
  


softon      05/02/20 02:21:50

  Log:
  Directory /cvsroot/simin/simingostop2/pyui/themes/future added to the repository


softon      05/02/20 02:23:44

  Modified:    pyui     themeBase.py widgets.py
  Log:
  add GostopCard widget
  
  Revision  Changes    Path
  1.2       +5 -0      simingostop2/pyui/themeBase.py
  
  Index: themeBase.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/themeBase.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- themeBase.py	4 Dec 2004 05:25:09 -0000	1.1
  +++ themeBase.py	19 Feb 2005 17:23:44 -0000	1.2
  @@ -211,3 +211,8 @@
       # frame methods
       def drawFrame(self, rect, title):
           return rect
  +
  +    # GostopCard methods
  +    def drawGostopCard(self, rect, card_id):
  +        return rect
  +    
  \ No newline at end of file
  
  
  
  1.15      +31 -0     simingostop2/pyui/widgets.py
  
  Index: widgets.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/widgets.py,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- widgets.py	5 Dec 2004 06:23:38 -0000	1.14
  +++ widgets.py	19 Feb 2005 17:23:44 -0000	1.15
  @@ -2369,3 +2369,34 @@
           Window.draw(self, renderer)        
       def button(self):
           return self.m_button
  +
  +
  +class GostopCard(Frame):
  +    
  +    HIDE = 0
  +    SHOW = 1
  +    
  +    def __init__(self, x, y, w, h, card_id, callback=None):
  +        Frame.__init__(self, x, y ,w, h, "card")
  +        
  +        self.card_id = card_id;
  +        self.callback = callback
  +        
  +        self.status = GostopCard.HIDE
  +        
  +        self.registerEvent(pyui.locals.LMOUSEBUTTONUP, self._pyuiMouseUp)
  +        
  +    def draw(self, renderer):
  +        if not self.show:
  +            return
  +        self.hitList = []
  +        getTheme().drawGostopCard(self.windowRect, self.card_id, self.status)
  +
  +    def _pyuiMouseUp(self, event):
  +        if not self.hit(event.pos):
  +            return 0
  +   
  +        if self.callback:
  +            self.callback(self)
  +            return 1
  +        return 0
  \ No newline at end of file
  
  
  


softon      05/02/20 02:23:44

  Modified:    pyui/themes future.py
  Log:
  add GostopCard widget
  
  Revision  Changes    Path
  1.2       +24 -0     simingostop2/pyui/themes/future.py
  
  Index: future.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/themes/future.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- future.py	4 Dec 2004 05:25:13 -0000	1.1
  +++ future.py	19 Feb 2005 17:23:44 -0000	1.2
  @@ -375,3 +375,27 @@
           self.renderer.drawRect(self.black, rect)
           self.renderer.drawRect(pyui.colors.yellow, (rect[0] + 1, rect[1] + 1, rect[2] - 2, rect[3] - 2))
           self.renderer.drawText(text, (rect[0] + 2, rect[1] + 2), pyui.colors.black)
  +
  +    #####################################################################
  +    ###
  +    ### Simin Gostop Widgets specific drawing functions.
  +    ###
  +    #####################################################################
  +
  +    # GostopCard methods
  +    def drawGostopCard(self, rect, card_id, status):
  +        import os
  +        from pyui.desktop import getRenderer
  +        if status == 1: # GostopCard.SHOW
  +            filename = 'card' + card_id + '.png'
  +        elif status == 0: #GostopCard.HIDE
  +            filename = 'card51.png'
  +                
  +        imagename = os.path.join('pyui/themes/future/', filename)
  +        getRenderer().drawImage((rect[0], rect[1], rect[2], rect[3]), imagename)
  +        
  +        return rect
  +
  +    def getPanImage(self):
  +        import os
  +        return os.path.join('pyui/themes/future/', 'pan.png');
  \ No newline at end of file
  
  
  


comfuture    05/02/20 03:20:09

  Modified:    .        ConfigHandler.py mainconfig.py
  Log:
  Ϸ 
  
  Revision  Changes    Path
  1.3       +5 -3      simingostop2/ConfigHandler.py
  
  Index: ConfigHandler.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/ConfigHandler.py,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConfigHandler.py	19 Feb 2005 15:57:40 -0000	1.2
  +++ ConfigHandler.py	19 Feb 2005 18:20:09 -0000	1.3
  @@ -47,12 +47,14 @@
       def setdata(self, data):
           self.data = data
   
  -    def save(self):
  +    def save(self, filename=None):
  +        if filename != None:
  +            self.filename = filename
           for sec in self.data.keys():
               if sec not in self.cp.sections():
                   self.cp.add_section(sec)
               for opt_key in self.data[sec].keys():
  -                self.cp.set(sec, opt_key, data[sec][opt_key])
  +                self.cp.set(sec, opt_key, self.data[sec][opt_key])
           f = open(self.filename,'w')
           self.cp.write(f)
           f.close()
  @@ -63,7 +65,7 @@
       print ch.flatdata() # ignore all section identifier
       data = {
           'global': {
  -            'nickname' : 'maroo'
  +            'nickname' : 'ģ'
           },
           'options' : {
               'fullscreen' : False,
  
  
  
  1.5       +27 -6     simingostop2/mainconfig.py
  
  Index: mainconfig.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/mainconfig.py,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- mainconfig.py	19 Feb 2005 15:57:40 -0000	1.4
  +++ mainconfig.py	19 Feb 2005 18:20:09 -0000	1.5
  @@ -26,18 +26,15 @@
           self.formPanel = pyui.widgets.FormPanel(self.fields)
           self.formPanel.setLayout(pyui.layouts.GridLayoutManager(2,5))
   
  -        positive_values = ["On","Yes","True","1"]
  -        negative_values = ["Off","No","False","0"]
  -
           if os.sys.platform == 'win32':
               userdata_dir = '%s%s.simin' % (os.getenv('USERPROFILE'),os.sep)
           else:
               userdata_dir = '%s%s.simin' % (os.getenv('HOME'),os.sep)
           self.cfg_file = "%s%ssetting.ini" % (userdata_dir,os.sep)
   
  -        ch = ConfigHandler()
  -        ch.load(self.cfg_file)
  -        prevdata = FakeAttrDict(ch.flatdata())
  +        self.ch = ConfigHandler()
  +        self.ch.load(self.cfg_file)
  +        prevdata = FakeAttrDict(self.ch.flatdata())
           self.formPanel.populate(prevdata)
           self.configFrame.replacePanel(self.formPanel)
           self.configFrame.addChild(self.btn_apply)
  @@ -46,6 +43,30 @@
   
       def onApply(self,button):
           # TODO: write config
  +        conf = {
  +            'global': {
  +                'nickname' : ''
  +            },
  +            'options' : {
  +                'fullscreen' : False,
  +                'bgsound' : False,
  +                'fxsound' : False
  +            }
  +        }
  +
  +        for sec in conf.keys():
  +            for opt_key in conf[sec].keys():
  +                element = getattr(self.formPanel,'widget_%s' % opt_key)
  +                if element.widgetLabel == 'Edit':
  +                    _value = element.text
  +                elif element.widgetLabel == 'CheckBox':
  +                    _value = element.checkState == 1 and 'Yes' or 'No'
  +                conf[sec][opt_key] = _value
  +        self.ch.setdata(conf)
  +        self.ch.save()
  +
  +        # TODO:
  +
           self.configFrame.destroy()
   
       def onCancel(self,button):
  
  
  


comfuture    05/02/20 03:20:09

  Modified:    pyui     widgets.py
  Log:
  Ϸ 
  
  Revision  Changes    Path
  1.16      +1 -0      simingostop2/pyui/widgets.py
  
  Index: widgets.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/widgets.py,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- widgets.py	19 Feb 2005 17:23:44 -0000	1.15
  +++ widgets.py	19 Feb 2005 18:20:09 -0000	1.16
  @@ -1092,6 +1092,7 @@
       onCheck is a method to be called when the checkbox changes state.
       """
       def __init__(self, text, onCheck = None):
  +        self.widgetLabel = 'CheckBox'
           self.checkState = 0
           self.text = text
           self._pyuiCheck = onCheck
  
  
  


comfuture    05/02/20 03:46:20

  Modified:    .        ConfigHandler.py mainconfig.py
  Log:
  
  
  Revision  Changes    Path
  1.4       +2 -0      simingostop2/ConfigHandler.py
  
  Index: ConfigHandler.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/ConfigHandler.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ConfigHandler.py	19 Feb 2005 18:20:09 -0000	1.3
  +++ ConfigHandler.py	19 Feb 2005 18:46:20 -0000	1.4
  @@ -25,6 +25,8 @@
               self.data[name] = {}
               for opt_key in self.cp.options(sec):
                   _value = self.cp.get(sec, opt_key)
  +                print _value
  +                print _value
                   if sec == 'options':
                       if _value in self.positive_values:
                           self.data[name][opt_key] = True
  
  
  
  1.6       +6 -2      simingostop2/mainconfig.py
  
  Index: mainconfig.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/mainconfig.py,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- mainconfig.py	19 Feb 2005 18:20:09 -0000	1.5
  +++ mainconfig.py	19 Feb 2005 18:46:20 -0000	1.6
  @@ -17,7 +17,7 @@
           self.btn_cancel = pyui.widgets.Button("", self.onCancel)
   
           self.fields = [
  -          ("text", "nickname", "Nickname:", 1, ""),
  +          ("text", "nickname", "г:", 1, ""),
             ("checkbox", "fullscreen", "Full Screen", 1, 0),
             ("checkbox", "bgsound", "Backgroud Music", 1, 0),
             ("checkbox", "fxsound", "FX Sound", 1, 0),
  @@ -30,6 +30,10 @@
               userdata_dir = '%s%s.simin' % (os.getenv('USERPROFILE'),os.sep)
           else:
               userdata_dir = '%s%s.simin' % (os.getenv('HOME'),os.sep)
  +
  +        if not os.path.isdir(userdata_dir):
  +            os.makedirs(userdata_dir)
  +
           self.cfg_file = "%s%ssetting.ini" % (userdata_dir,os.sep)
   
           self.ch = ConfigHandler()
  @@ -58,7 +62,7 @@
               for opt_key in conf[sec].keys():
                   element = getattr(self.formPanel,'widget_%s' % opt_key)
                   if element.widgetLabel == 'Edit':
  -                    _value = element.text
  +                    _value = element.text.encode('euc-kr')
                   elif element.widgetLabel == 'CheckBox':
                       _value = element.checkState == 1 and 'Yes' or 'No'
                   conf[sec][opt_key] = _value
  
  
  


comfuture    05/02/20 03:46:51

  Modified:    .        ConfigHandler.py
  Log:
  
  
  Revision  Changes    Path
  1.5       +0 -1      simingostop2/ConfigHandler.py
  
  Index: ConfigHandler.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/ConfigHandler.py,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ConfigHandler.py	19 Feb 2005 18:46:20 -0000	1.4
  +++ ConfigHandler.py	19 Feb 2005 18:46:51 -0000	1.5
  @@ -26,7 +26,6 @@
               for opt_key in self.cp.options(sec):
                   _value = self.cp.get(sec, opt_key)
                   print _value
  -                print _value
                   if sec == 'options':
                       if _value in self.positive_values:
                           self.data[name][opt_key] = True
  
  
  


exman       05/02/20 04:01:01

  Modified:    .        ConfigHandler.py mainconfig.py menu.py sockevt.py
  Log:
  houselist & fullscreen ...
  
  Revision  Changes    Path
  1.6       +2 -2      simingostop2/ConfigHandler.py
  
  Index: ConfigHandler.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/ConfigHandler.py,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ConfigHandler.py	19 Feb 2005 18:46:51 -0000	1.5
  +++ ConfigHandler.py	19 Feb 2005 19:01:01 -0000	1.6
  @@ -25,7 +25,7 @@
               self.data[name] = {}
               for opt_key in self.cp.options(sec):
                   _value = self.cp.get(sec, opt_key)
  -                print _value
  +                print sec, _value
                   if sec == 'options':
                       if _value in self.positive_values:
                           self.data[name][opt_key] = True
  @@ -34,7 +34,7 @@
                       else:
                           self.data[name][opt_key] = _value
                   else:
  -                    self.data[name][opt_key] = self.cp.get(sec, opt_key)
  +                    self.data[name][opt_key] = self.cp.get(sec, opt_key).decode('euc-kr')
   
       def flatdata(self):
           ret = {}
  
  
  
  1.7       +1 -0      simingostop2/mainconfig.py
  
  Index: mainconfig.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/mainconfig.py,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- mainconfig.py	19 Feb 2005 18:46:20 -0000	1.6
  +++ mainconfig.py	19 Feb 2005 19:01:01 -0000	1.7
  @@ -70,6 +70,7 @@
           self.ch.save()
   
           # TODO:
  +        pyui.desktop.getRenderer().setFullScreen(1)
   
           self.configFrame.destroy()
   
  
  
  
  1.20      +18 -2     simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- menu.py	19 Feb 2005 15:37:46 -0000	1.19
  +++ menu.py	19 Feb 2005 19:01:01 -0000	1.20
  @@ -31,7 +31,17 @@
           self.pack()
   
       def onButton(self, button):
  -        self.close()
  +        item = self.listbox.getSelectedItem()
  +        if not item:
  +            mb = pyui.dialogs.MessageBox("Ȯ", "Ͽ콺 Ͽ ֽʽÿ.")
  +            mb.doModal()
  +            return
  +        print item
  +        #self.close()
  +
  +    def onCloseButton(self):
  +        """close ư  ҿ ..."""
  +        return
   
       def close(self):
           self.listbox = None
  @@ -63,6 +73,7 @@
           mb = pyui.dialogs.MessageBox("Ȯ", "йȣ Ǵ ̵ Ȯϼ.")
           mb.doModal()
       def onLoginHouseList(self, *args):
  +        print args
           self.hd = houseDialog(args[0])
           self.hd.doModal()
       def show(self):
  @@ -95,6 +106,10 @@
           """
           #pyui.desktop.getTheme().drawButton((100,100,100,60), "haha", True, 0, 1)
       def onLobby(self, button):
  +        if sockevt.sock!=None:
  +            mb = pyui.dialogs.MessageBox("Ȯ", "̹ α Դϴ.")
  +            mb.doModal()
  +            return 
           self.td = loginDialog()
           self.td.doModal()
           
  @@ -158,7 +173,8 @@
   
           sockevt.sock = socket(AF_INET, SOCK_STREAM)
           try:
  -            sockevt.sock.connect(('simin.h-9.net',1234))
  +            # ׽Ʈ ϴ localhost  ...
  +            sockevt.sock.connect(('localhost',1234))
           except:
               print "TT"
               return
  
  
  
  1.4       +5 -3      simingostop2/sockevt.py
  
  Index: sockevt.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/sockevt.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- sockevt.py	12 Dec 2004 14:51:13 -0000	1.3
  +++ sockevt.py	19 Feb 2005 19:01:01 -0000	1.4
  @@ -54,15 +54,17 @@
                   print "̹ α : %d" % ret
                   emit(LOGIN_ALREADY)
           elif minor==RESPONSE_LOBBY_LOGINHOUSELIST:
  -            count = struct.unpack("!H", data[:2])[0]
  -            p = 2
  +            count = struct.unpack("B", data[0])[0]
  +            p = 1
               list = []
               for x in range(count):
                   l = struct.unpack("B", data[p])[0]; p+=1
                   housename = data[p:p+l]; p+=l
                   l = struct.unpack("B", data[p])[0]; p+=1
                   houseinfo = data[p:p+l]; p+=l
  -                list.append((housename, houseinfo))
  +                housecur = struct.unpack("H", data[p:p+2])[0]; p+=2
  +                housemax = struct.unpack("H", data[p:p+2])[0]; p+=2
  +                list.append((housename, houseinfo, housecur, housemax))
               emit(LOGIN_HOUSELIST, list)
       
   
  
  
  


exman       05/02/20 04:01:02

  Modified:    pyui/renderers pygame2D.py
  Log:
  houselist & fullscreen ...
  
  Revision  Changes    Path
  1.5       +9 -6      simingostop2/pyui/renderers/pygame2D.py
  
  Index: pygame2D.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/renderers/pygame2D.py,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- pygame2D.py	5 Dec 2004 06:23:38 -0000	1.4
  +++ pygame2D.py	19 Feb 2005 19:01:02 -0000	1.5
  @@ -35,12 +35,7 @@
           pygame.init()
           self.width = w
           self.height = h
  -        if fullscreen:
  -            self.screen = pygame.display.set_mode((w, h), FULLSCREEN | SWSURFACE)
  -            self.fullscreen = 1
  -        else:
  -            self.screen = pygame.display.set_mode((w, h))
  -            self.fullscreen = 0
  +        self.setFullScreen(fullscreen)
           self.screen.set_alpha(255)
               
           pygame.key.set_mods(KMOD_NONE)
  @@ -86,6 +81,14 @@
           self.images = {}
   
           self.drawBackMethod = self.clear
  +
  +    def setFullScreen(self, fullscreen):
  +        if fullscreen:
  +            self.screen = pygame.display.set_mode((self.width, self.height), FULLSCREEN | SWSURFACE)
  +            self.fullscreen = 1
  +        else:
  +            self.screen = pygame.display.set_mode((self.width, self.height))
  +            self.fullscreen = 0
           
       def doesDirtyRects(self):
           return 1
  
  
  


comfuture    05/02/20 04:21:37

  Modified:    .        ConfigHandler.py mainconfig.py
  Log:
  
  
  Revision  Changes    Path
  1.7       +1 -8      simingostop2/ConfigHandler.py
  
  Index: ConfigHandler.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/ConfigHandler.py,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ConfigHandler.py	19 Feb 2005 19:01:01 -0000	1.6
  +++ ConfigHandler.py	19 Feb 2005 19:21:37 -0000	1.7
  @@ -24,15 +24,8 @@
               name = sec.lower()
               self.data[name] = {}
               for opt_key in self.cp.options(sec):
  -                _value = self.cp.get(sec, opt_key)
  -                print sec, _value
                   if sec == 'options':
  -                    if _value in self.positive_values:
  -                        self.data[name][opt_key] = True
  -                    elif _value in self.negative_values:
  -                        self.data[name][opt_key] = False
  -                    else:
  -                        self.data[name][opt_key] = _value
  +                    self.data[name][opt_key] = self.cp.getboolean(sec,opt_key)
                   else:
                       self.data[name][opt_key] = self.cp.get(sec, opt_key).decode('euc-kr')
   
  
  
  
  1.8       +1 -2      simingostop2/mainconfig.py
  
  Index: mainconfig.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/mainconfig.py,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- mainconfig.py	19 Feb 2005 19:01:01 -0000	1.7
  +++ mainconfig.py	19 Feb 2005 19:21:37 -0000	1.8
  @@ -69,8 +69,7 @@
           self.ch.setdata(conf)
           self.ch.save()
   
  -        # TODO:
  -        pyui.desktop.getRenderer().setFullScreen(1)
  +        pyui.desktop.getRenderer().setFullScreen(int(conf['options']['fullscreen'] == 'Yes'))
   
           self.configFrame.destroy()
   
  
  
  


exman       05/02/20 05:00:27

  Modified:    .        menu.py protocol.py sockevt.py
  Log:
  house login
  
  Revision  Changes    Path
  1.21      +27 -3     simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- menu.py	19 Feb 2005 19:01:01 -0000	1.20
  +++ menu.py	19 Feb 2005 20:00:27 -0000	1.21
  @@ -22,7 +22,7 @@
   
           self.listbox = pyui.widgets.ListBox()
           for i in range(len(houseList)):
  -            self.listbox.addItem(houseList[i][0], 0)
  +            self.listbox.addItem(houseList[i][0]+" (%02d/%02d)" % (houseList[i][2],houseList[i][3]), houseList[i])
   
           self.button = pyui.widgets.Button("Ͽ콺 ", self.onButton)
   
  @@ -36,7 +36,16 @@
               mb = pyui.dialogs.MessageBox("Ȯ", "Ͽ콺 Ͽ ֽʽÿ.")
               mb.doModal()
               return
  -        print item
  +        
  +        if item.data[2]>=item.data[3]:
  +            mb = pyui.dialogs.MessageBox("Ȯ", "ο  áϴ.")
  +            mb.doModal()
  +            return
  +        serverinfo = item.data[1].split(":")
  +        # FIXME   ؾ ...ϴ ׳ Ͽ콺 α 
  +        print serverinfo
  +        sockevt.sock.send(struct.pack("!BBH", M_HOUSE, REQUEST_HOUSE_LOGIN, len(sockevt.ticket)))
  +        sockevt.sock.send(sockevt.ticket)
           #self.close()
   
       def onCloseButton(self):
  @@ -63,11 +72,15 @@
           sockevt.connectEvent(sockevt.LOGIN_FAIL, self.onLoginFail)
           sockevt.connectEvent(sockevt.LOGIN_HOUSELIST, self.onLoginHouseList)
   
  +        sockevt.connectEvent(sockevt.HOUSE_LOGIN_SUCCESS, self.onHouseLoginSuccess)
  +        sockevt.connectEvent(sockevt.HOUSE_LOGIN_FAIL, self.onHouseLoginFail)
  +
       def onLoginSuccess(self, *args):
           self.td.close()
           snd.play("voice", "loginsuccess%d" % random.randint(0, 1))
       def onLoginAlready(self, *args):
  -        snd.play("voice", "loginfail")
  +        mb = pyui.dialogs.MessageBox("Ȯ", "̹ α Ǿϴ.")
  +        mb.doModal()
       def onLoginFail(self, *args):
           snd.play("voice", "loginfail")
           mb = pyui.dialogs.MessageBox("Ȯ", "йȣ Ǵ ̵ Ȯϼ.")
  @@ -76,6 +89,17 @@
           print args
           self.hd = houseDialog(args[0])
           self.hd.doModal()
  +
  +    def onHouseLoginSuccess(self, *args):
  +        self.hd.close()
  +        sockevt.sock.send(struct.pack("!BBH", M_HOUSE, REQUEST_HOUSE_PANLIST, len(id)+len(passwd)+2))
  +        sockevt.sock.send(struct.pack("B", len(id)))
  +    def onHouseLoginFail(self, *args):
  +        snd.play("voice", "loginfail")
  +        mb = pyui.dialogs.MessageBox("Ȯ", "Internal Error: Fail to HouseLogin")
  +        mb.doModal()
  +
  +
       def show(self):
           self.btnLobby.show = 1
           self.btnNews.show = 1
  
  
  
  1.3       +8 -0      simingostop2/protocol.py
  
  Index: protocol.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/protocol.py,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- protocol.py	5 Dec 2004 03:28:27 -0000	1.2
  +++ protocol.py	19 Feb 2005 20:00:27 -0000	1.3
  @@ -1,6 +1,7 @@
   M_RESERVATION                               = 0x00
   M_LOBBY                                     = 0x01
   M_HOUSE                                     = 0x03
  +M_PAN                                       = 0x04
   M_GAME_RESERVATION                          = 0x10
   M_GAME_GOSTOP                               = 0x11
   
  @@ -52,3 +53,10 @@
   #### HOUSE Protocol 
   REQUEST_HOUSE_LOGIN                         = 0x81
   RESPONSE_HOUSE_LOGIN                        = 0xC1
  +REQUEST_HOUSE_PANLIST                       = 0x12
  +RESPONSE_HOUSE_PANLIST                      = 0xB2
  +NOTIFY_HOUSE_PANDIFF                        = 0xB3
  +REQUEST_HOUSE_CREATEPAN                     = 0x11
  +RESPONSE_HOUSE_CREATEPAN                    = 0xB1
  +
  +## PAN PROTOCOL
  
  
  
  1.5       +14 -0     simingostop2/sockevt.py
  
  Index: sockevt.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/sockevt.py,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- sockevt.py	19 Feb 2005 19:01:01 -0000	1.4
  +++ sockevt.py	19 Feb 2005 20:00:27 -0000	1.5
  @@ -12,11 +12,14 @@
   
   sock = None
   buffer = ""
  +ticket = ""
   
   LOGIN_SUCCESS = 0
   LOGIN_ALREADY = 1
   LOGIN_FAIL    = 2
   LOGIN_HOUSELIST = 3
  +HOUSE_LOGIN_SUCCESS = 4
  +HOUSE_LOGIN_FAIL = 5
   eventHandler = {}
   
   def connectEvent(type, callback):
  @@ -37,6 +40,7 @@
           if minor==RESPONSE_LOBBY_LOGIN:
               ret = struct.unpack("B", data[0])[0]
               if ret==0x00:
  +                global ticket
                   ticket = data[1:]
                   print "α ! ", ticket
                   emit(LOGIN_SUCCESS)
  @@ -66,6 +70,16 @@
                   housemax = struct.unpack("H", data[p:p+2])[0]; p+=2
                   list.append((housename, houseinfo, housecur, housemax))
               emit(LOGIN_HOUSELIST, list)
  +    if major==M_HOUSE:
  +        if minor==RESPONSE_HOUSE_LOGIN:
  +            ticketok = struct.unpack("B", data[0])[0]
  +            p = 1
  +            usernamelen = struct.unpack("H", data[p:p+2])[0]; p+=2
  +            username = data[p:]
  +            if ticketok:
  +                emit(HOUSE_LOGIN_SUCCESS, username)
  +            else:
  +                emit(HOUSE_LOGIN_FAIL)
       
   
   def hexdump(buffer):
  
  
  


exman       05/02/20 05:03:36

  Modified:    .        menu.py
  Log:
  Ӽ Ҽ ϴ. ޽ ߰
  
  Revision  Changes    Path
  1.22      +2 -1      simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- menu.py	19 Feb 2005 20:00:27 -0000	1.21
  +++ menu.py	19 Feb 2005 20:03:36 -0000	1.22
  @@ -200,7 +200,8 @@
               # ׽Ʈ ϴ localhost  ...
               sockevt.sock.connect(('localhost',1234))
           except:
  -            print "TT"
  +            mb = pyui.dialogs.MessageBox("Ȯ", "     ϴ.")
  +            mb.doModal()
               return
   
           passwd=md5.md5(passwd).hexdigest()
  
  
  


exman       05/02/20 05:05:11

  Modified:    .        menu.py
  Log:
  
  
  Revision  Changes    Path
  1.23      +1 -0      simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- menu.py	19 Feb 2005 20:03:36 -0000	1.22
  +++ menu.py	19 Feb 2005 20:05:11 -0000	1.23
  @@ -200,6 +200,7 @@
               # ׽Ʈ ϴ localhost  ...
               sockevt.sock.connect(('localhost',1234))
           except:
  +            sockevt.sock = None
               mb = pyui.dialogs.MessageBox("Ȯ", "     ϴ.")
               mb.doModal()
               return
  
  
  


exman       05/02/20 05:57:42

  Modified:    .        menu.py sockevt.py
  Log:
  panlist ޾ƿ
  
  Revision  Changes    Path
  1.24      +3 -2      simingostop2/menu.py
  
  Index: menu.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/menu.py,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- menu.py	19 Feb 2005 20:05:11 -0000	1.23
  +++ menu.py	19 Feb 2005 20:57:42 -0000	1.24
  @@ -92,8 +92,9 @@
   
       def onHouseLoginSuccess(self, *args):
           self.hd.close()
  -        sockevt.sock.send(struct.pack("!BBH", M_HOUSE, REQUEST_HOUSE_PANLIST, len(id)+len(passwd)+2))
  -        sockevt.sock.send(struct.pack("B", len(id)))
  +        import mainlobby
  +        desktopmanager.setCurrentDesktop(mainlobby.LobbyDesktop())
  +
       def onHouseLoginFail(self, *args):
           snd.play("voice", "loginfail")
           mb = pyui.dialogs.MessageBox("Ȯ", "Internal Error: Fail to HouseLogin")
  
  
  
  1.6       +20 -0     simingostop2/sockevt.py
  
  Index: sockevt.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/sockevt.py,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- sockevt.py	19 Feb 2005 20:00:27 -0000	1.5
  +++ sockevt.py	19 Feb 2005 20:57:42 -0000	1.6
  @@ -20,6 +20,7 @@
   LOGIN_HOUSELIST = 3
   HOUSE_LOGIN_SUCCESS = 4
   HOUSE_LOGIN_FAIL = 5
  +HOUSE_PANLIST = 6
   eventHandler = {}
   
   def connectEvent(type, callback):
  @@ -80,6 +81,25 @@
                   emit(HOUSE_LOGIN_SUCCESS, username)
               else:
                   emit(HOUSE_LOGIN_FAIL)
  +        elif minor==RESPONSE_HOUSE_PANLIST:
  +            count = struct.unpack("H", data[:2])[0]
  +            p = 2
  +            list = []
  +            for x in range(count):
  +                panid = data[p:p+14]; p+=14
  +                l = struct.unpack("H", data[p:p+2])[0]; p+=2
  +                topic = data[p:p+l]; p+=l
  +                maxuser = struct.unpack("B", data[p])[0]; p+=1
  +                curuser = struct.unpack("B", data[p])[0]; p+=1
  +                usercount = struct.unpack("B", data[p])[0]; p+=1
  +                users = []
  +                for y in range(usercount):
  +                    user = data[p:p+l]; p+=l
  +                    users.append(user)
  +                status = struct.unpack("B", data[p])[0]; p+=1
  +                secret = struct.unpack("B", data[p])[0]; p+=1
  +                list.append((panid, topic, maxuser, curuser, users, status, secret))
  +            emit(HOUSE_PANLIST, list)
       
   
   def hexdump(buffer):
  
  
  


exman       05/02/20 06:51:16

  Added:       .        mainlobby.py
  Log:
  κȭ ߰
  
  Revision  Changes    Path
  1.1                  simingostop2/mainlobby.py
  
  Index: mainlobby.py
  ===================================================================
  # -*- coding: euc-kr -*-
  import time
  import pyui
  from pyui.locals import *
  from pyui import snd
  from pyui.base import *
  
  import random
  import sockevt
  from socket import *
  import md5, struct
  from protocol import *
  import pygame, os
  from pygame.locals import *
  from math import sin
  import desktopmanager
  
  
  class LobbyDesktop(desktopmanager.BaseDesktop):
      def __init__(self):
          desktopmanager.BaseDesktop.__init__(self)
          pyui.desktop.getRenderer().setBackMethod(self.drawBack)
          self.anim = 0.0
  
  
          #  ̺Ʈ
          sockevt.connectEvent(sockevt.HOUSE_PANLIST, self.onPanList)
          
          # ǸƮ û
          sockevt.sock.send(struct.pack("!BBH", M_HOUSE, REQUEST_HOUSE_PANLIST, 0))
      def onPanList(self, *args):
          print args
      def onQuit(self, event):
          desktopmanager.setPreviousDesktop()
  
      def show(self):
          pyui.desktop.getRenderer().setBackMethod(self.drawBack)
  
      def hide(self):
          pass
  
      def drawBack(self):
          renderer = pyui.desktop.getRenderer()
          renderer.setup2D()
  
          renderer.clear()
          renderer.drawImage((0,0,800,600), "data/background/lobbybg.png")
          renderer.teardown2D()
  
  
  


exman       05/02/20 06:51:16

  Added:       data/background lobbybg.png
  Log:
  κȭ ߰
  
  Revision  Changes    Path
  1.1                  simingostop2/data/background/lobbybg.png
  
  	<<Binary file>>
  
  


softon      05/02/20 07:16:07

  Modified:    .        protocol.py sockevt.py
  Added:       .        gamedesktop.py
  Log:
  add gamedesktop
  
  Revision  Changes    Path
  1.4       +19 -0     simingostop2/protocol.py
  
  Index: protocol.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/protocol.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- protocol.py	19 Feb 2005 20:00:27 -0000	1.3
  +++ protocol.py	19 Feb 2005 22:16:07 -0000	1.4
  @@ -60,3 +60,22 @@
   RESPONSE_HOUSE_CREATEPAN                    = 0xB1
   
   ## PAN PROTOCOL
  +
  +
  +# Minor code in M_GAME_GOSTOP
  +REQUEST_GAME_GOSTOP_START                   = 0x01
  +REQUEST_GAME_GOSTOP_GO                      = 0x02
  +REQUEST_GAME_GOSTOP_STOP                    = 0x03
  +REQUEST_GAME_GOSTOP_NORMAL                  = 0x11
  +REQUEST_GAME_GOSTOP_SHAKE                   = 0x12
  +REQUEST_GAME_GOSTOP_BOMB                    = 0x13
  +REQUEST_GAME_GOSTOP_SELECT                  = 0x21
  +
  +NOTIFY_GAME_GOSTOP_START                    = 0x51
  +NOTIFY_GAME_GOSTOP_END                      = 0x52
  +NOTIFY_GAME_GOSTOP_TURN                     = 0x53
  +NOTIFY_GAME_GOSTOP_BONUS                    = 0x54
  +NOTIFY_GAME_GOSTOP_BONUSGET                 = 0x55
  +NOTIFY_GAME_GOSTOP_CARD                     = 0x56
  +NOTIFY_GAME_GOSTOP_SELECT                   = 0x57
  +NOTIFY_GAME_GOSTOP_GOSTOP                   = 0x58
  
  
  
  1.7       +29 -1     simingostop2/sockevt.py
  
  Index: sockevt.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/sockevt.py,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- sockevt.py	19 Feb 2005 20:57:42 -0000	1.6
  +++ sockevt.py	19 Feb 2005 22:16:07 -0000	1.7
  @@ -23,6 +23,15 @@
   HOUSE_PANLIST = 6
   eventHandler = {}
   
  +GAME_START = 10
  +GAME_END = 11
  +GAME_TURN = 12
  +GAME_BONUS = 13
  +GAME_BONUSGET = 14
  +GAME_CARD = 15
  +GAME_SELECT = 16
  +GAME_GOSTOP = 17
  +
   def connectEvent(type, callback):
       global eventHandler
       if eventHandler.has_key(type):
  @@ -71,7 +80,8 @@
                   housemax = struct.unpack("H", data[p:p+2])[0]; p+=2
                   list.append((housename, houseinfo, housecur, housemax))
               emit(LOGIN_HOUSELIST, list)
  -    if major==M_HOUSE:
  +
  +    elif major==M_HOUSE:
           if minor==RESPONSE_HOUSE_LOGIN:
               ticketok = struct.unpack("B", data[0])[0]
               p = 1
  @@ -101,6 +111,24 @@
                   list.append((panid, topic, maxuser, curuser, users, status, secret))
               emit(HOUSE_PANLIST, list)
       
  +    elif major==M_GAME_GOSTOP:
  +        if minor==NOTIFY_GAME_GOSTOP_START:
  +            emit(GAME_START)
  +        elif minor==NOTIFY_GAME_GOSTOP_END:
  +            emit(GAME_END)
  +        elif minor==NOTIFY_GAME_GOSTOP_TURN:
  +            emit(GAME_TURN)
  +        elif minor==NOTIFY_GAME_GOSTOP_BONUS:
  +            emit(GAME_BONUS)
  +        elif minor==NOTIFY_GAME_GOSTOP_BONUSGET:
  +            emit(GAME_BONUSGET)
  +        elif minor==NOTIFY_GAME_GOSTOP_CARD:
  +            emit(GAME_CARD)
  +        elif minor==NOTIFY_GAME_GOSTOP_SELECT:
  +            emit(GAME_SELECT)
  +        elif minor==NOTIFY_GAME_GOSTOP_GOSTOP:
  +            emit(GAME_GOSTOP)
  +    
   
   def hexdump(buffer):
       i=0
  
  
  
  1.1                  simingostop2/gamedesktop.py
  
  Index: gamedesktop.py
  ===================================================================
  # -*- coding: euc-kr -*-
  import desktopmanager
  import pyui
  from pyui.locals import *
  import os, pygame, sys
  
  import sockevt, struct
  from protocol import *        
  
  def makePacket(minor, data):
      msglen = len(data)
      result = struct.pack("!BBB", M_GAME_GOSTOP, minor, msglen)
      
      if msglen > 0:
          result += struct.pack("!B", data)
  
      return result
  
  
  class GameDesktop(desktopmanager.BaseDesktop):
      def __init__(self):
          desktopmanager.BaseDesktop.__init__(self)
          pyui.desktop.getRenderer().setBackMethod(self.drawBack)
          pyui.desktop.getDesktop().registerHandler(KEYDOWN, self.onKeyDown)
          pyui.desktop.getDesktop().registerHandler(RMOUSEBUTTONUP, self.onRMouseUp)
          
          self.users = 1 # game users
          self.turn = 0
          
          #init card 
          self.card = []
          for i in range(51):
              self.card.append( pyui.widgets.GostopCard( 0, 0, 36, 55, '%.2d' % i, self.onEventCard ) )
              
          #socket event 
          sockevt.connectEvent(sockevt.GAME_START, self.onGameStart)
          sockevt.connectEvent(sockevt.GAME_END, self.onGameEnd)
          sockevt.connectEvent(sockevt.GAME_TURN, self.onGameTurn)
          sockevt.connectEvent(sockevt.GAME_BONUS, self.onGameBonus)
          sockevt.connectEvent(sockevt.GAME_BONUSGET, self.onGameBonusGet)
          sockevt.connectEvent(sockevt.GAME_CARD, self.onGameCard)
          sockevt.connectEvent(sockevt.GAME_SELECT, self.onGameSelect)
          sockevt.connectEvent(sockevt.GAME_GOSTOP, self.onGameGostop)
          
  
      #keydown event
      def onKeyDown(self, event):
          if event.key == pygame.K_ESCAPE:
              self.onQuit()
          elif event.key == pygame.K_0:
              pass
  
              
      #test ̺Ʈ
      def onRMouseUp(self, event):
          '''
          for i in range(51):
              if i < 10 :
                  self.card[i].card_type = pyui.widgets.GostopCard.TYPE_MINE
                  self.card[i].card_num = '%.2d' % (i * 4 + 1)
              elif i < 20 :
                  self.card[i].card_type = pyui.widgets.GostopCard.TYPE_OTHER1
              elif i < 30 :
                  self.card[i].card_type = pyui.widgets.GostopCard.TYPE_PAN
                  self.card[i].card_num = '%.2d' % ((i-20)*4 + 2)
                  
              self.users = 2
              #sockevt.sock.send(struct.pack("!BB", M_GAME_GOSTOP, REQUEST_GAME_GOSTOP_START))
          self.initCardMove()
          '''
          pass
          
      def onQuit(self):
          for i in range(51):
              self.card[i].destroy()
          pyui.desktop.getDesktop().unregisterHandler(KEYDOWN)
          desktopmanager.setPreviousDesktop()
  
      def show(self):
          pyui.desktop.getRenderer().setBackMethod(self.drawBack)
          
          
      def drawBack(self):
          #load image
          from pyui.desktop import getTheme
          bitmap = pygame.image.load( getTheme().getPanImage() ).convert()
  
          screen = pyui.desktop.getRenderer().screen
          screen.blit( bitmap, (0, 0) )
      
  
      # card Ŭ Ͼ ̺Ʈ..
      def onEventCard(self, card):
          if card.card_type == pyui.widgets.GostopCard.TYPE_MINE :
              if self.turn == 1 :#  ϶  и ϰ  ѱ.
                  self.turn = 0
                  #sockevt.sock.send(struct.pack("!BBB", M_GAME_GOSTOP, REQUEST_GAME_GOSTOP_NORMAL, card.card_num))
                  print 'click : my card(turn)'
              else :
                  print 'click : my card'
              pass
          elif( card.card_type == pyui.widgets.GostopCard.TYPE_PAN ) :
              print 'click : pan card'
              pass
          elif( card.card_type == pyui.widgets.GostopCard.TYPE_NORMAL ) :
              print 'click : normal card'
              pass
          pass        
          
      def initCardMove(self):
          w = self.card[0].width
          h = self.card[0].height
          normal_count = 0
          pan_count = 0
          mine_count = 0
          other1_count = 0
          other2_count = 0
          for i in range(51):
              if self.card[i].card_type == pyui.widgets.GostopCard.TYPE_NORMAL :
                  self.card[i].move( (800 - w)/2-normal_count, (600 - h)/2-normal_count); normal_count+=1
              elif self.card[i].card_type == pyui.widgets.GostopCard.TYPE_PAN :
                  self.card[i].move( 200+pan_count*40, 350 ); pan_count+=1
              elif self.card[i].card_type == pyui.widgets.GostopCard.TYPE_MINE :
                  if mine_count < 5 :
                      self.card[i].move( 600+mine_count*40, 470 ); mine_count +=1
                  else :
                      self.card[i].move( 600+(mine_count-5)*40, 530 ); mine_count+=1
              elif self.users == 2 : # °
                  if self.card[i].card_type == pyui.widgets.GostopCard.TYPE_OTHER1 :
                      if other1_count < 5 :
                          self.card[i].move( 600+other1_count*40, 20 ); other1_count +=1
                      else :
                          self.card[i].move( 600+(other1_count-5)*40, 80 ); other1_count+=1
              elif self.users == 3 :
                  if self.card[i].card_type == pyui.widgets.GostopCard.TYPE_OTHER1 :
                      pass
                  elif self.card[i].card_type == pyui.widgets.GostopCard.TYPE_OTHER2 :
                      pass
  
  # socket event ޴ κ
      def onGameStart(self, *args):
          i = 0
          p = 0
  
          # ٴڿ  
          count = int( struct.unpack("B", args[0])[0] )
          for x in range(count):
              self.card[i].card_num = struct.unpack("!B", data[p])[0]; p+=1
              self.card[i].card_type = pyui.widgets.GostopCard.TYPE_PAN; i+=1
          
          #   
          count = struct.unpack("B", args[p])[0]; p+=1
          for x in range(count):
              self.card[i].card_num = struct.unpack("!B", data[p])[0]; p+=1
              self.card[i].card_type = pyui.widgets.GostopCard.TYPE_MINE; i+=1
              
          #  
          self.users = int( struct.unpack("B", args[p])[0] ); p+=1
          if self.users == 2 : # °
              for x in range(count):
                  self.card[i].card_type = pyui.widgets.GostopCard.TYPE_OTHER1; i+=1
          elif self.users == 3 :
              for x in range(count):
                  self.card[i].card_type = pyui.widgets.GostopCard.TYPE_OTHER1; i+=1
              for x in range(count):
                  self.card[i].card_type = pyui.widgets.GostopCard.TYPE_OTHER2; i+=1
          
          self.initCardMove()
  
           
      def onGameEnd(self, *args):
          for i in range(51):
              self.card[i].card_type = pyui.widgets.GostopCard.TYPE_NORMAL
              self.card[i].card_num = -1
              
          self.initCardMove()
              
      def onGameTurn(self, *args):
          self.turn = 1
          pass
      def onGameBonus(self, *args):
          pass
          
      def onGameBonusGet(self, *args):
          pass
          
      def onGameCard(self, *args):
          pass
          
      def onGameSelect(self, *args):
          pass
          
      def onGameGostop(self, *args):
          GostopDialog()
          
  
  
  class GostopDialog(pyui.dialogs.Dialog):
      def __init__(self):
          pyui.dialogs.Dialog.__init__(self, 225, 250, 350, 140, "Go Stop!!")
          self.setLayout(pyui.layouts.GridLayoutManager(1, 2))
  
          self.buttonGo = pyui.widgets.Button("Go", self.onButtonGo)
          self.buttonStop = pyui.widgets.Button("Stop", self.onButtonStop)
          
          self.addChild(self.buttonGo)
          self.addChild(self.buttonStop)
          self.pack()
          
      def onButtonGo(self, button):
          print "go"
          #sockevt.sock.send(struct.pack("!BB", M_GAME_GOSTOP, REQUEST_GAME_GOSTOP_GO))
          self.destroy()
  
      def onButtonStop(self, button):
          print "stop"
          #sockevt.sock.send(struct.pack("!BB", M_GAME_GOSTOP, REQUEST_GAME_GOSTOP_STOP))
          self.destroy()
      
  
  


softon      05/02/20 07:16:08

  Modified:    pyui     themeBase.py widgets.py
  Log:
  add gamedesktop
  
  Revision  Changes    Path
  1.3       +1 -1      simingostop2/pyui/themeBase.py
  
  Index: themeBase.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/themeBase.py,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- themeBase.py	19 Feb 2005 17:23:44 -0000	1.2
  +++ themeBase.py	19 Feb 2005 22:16:08 -0000	1.3
  @@ -213,6 +213,6 @@
           return rect
   
       # GostopCard methods
  -    def drawGostopCard(self, rect, card_id):
  +    def drawGostopCard(self, rect, card_num):
           return rect
       
  \ No newline at end of file
  
  
  
  1.17      +19 -14    simingostop2/pyui/widgets.py
  
  Index: widgets.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/widgets.py,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- widgets.py	19 Feb 2005 18:20:09 -0000	1.16
  +++ widgets.py	19 Feb 2005 22:16:08 -0000	1.17
  @@ -1699,8 +1699,9 @@
           self.panelOffsetBottom = self.theme.getFrameBorderBottom()            
               
           self._panel.moveto(self.panelOffsetLeft, self.panelOffsetTop)
  -        w += self.panelOffsetLeft + self.panelOffsetRight
  -        h += self.panelOffsetTop + self.panelOffsetBottom
  +        if not self.widgetLabel == 'GostopCard':
  +            w += self.panelOffsetLeft + self.panelOffsetRight
  +            h += self.panelOffsetTop + self.panelOffsetBottom
               
           self.resize(w, h)
           self.registerEvent(pyui.locals.LMOUSEBUTTONDOWN, self._pyuiMouseDown)
  @@ -1827,10 +1828,11 @@
           return 1
   
       def resize(self, w, h):
  -        if w < 64:
  -            w = 64
  -        if h < 64:
  -            h = 64
  +        if not self.widgetLabel == 'GostopCard':
  +            if w < 64:
  +                w = 64
  +            if h < 64:
  +                h = 64
           Base.resize(self, w, h)
           self.innerWidth = w - self.panelOffsetLeft - self.panelOffsetRight
           self.innerHeight = h - self.panelOffsetTop - self.panelOffsetBottom
  @@ -2373,25 +2375,28 @@
   
   
   class GostopCard(Frame):
  -    
  -    HIDE = 0
  -    SHOW = 1
  +    TYPE_NORMAL = 0 #  
  +    TYPE_PAN = 1    # ǿ  
  +    TYPE_MINE = 2   #  
  +    TYPE_OTHER1 = 3  # ٸ 1 
  +    TYPE_OTHER2 = 4  # ٸ 2 
  +    widgetLabel = 'GostopCard'
       
       def __init__(self, x, y, w, h, card_id, callback=None):
           Frame.__init__(self, x, y ,w, h, "card")
  -        
  -        self.card_id = card_id;
  +        #self.resize(w, h)
  +        self.card_id = card_id;    # client  ī带 ϱ  id
  +        self.card_num = -1         #  ..     : -1
  +        self.card_type = GostopCard.TYPE_NORMAL
           self.callback = callback
           
  -        self.status = GostopCard.HIDE
  -        
           self.registerEvent(pyui.locals.LMOUSEBUTTONUP, self._pyuiMouseUp)
           
       def draw(self, renderer):
           if not self.show:
               return
           self.hitList = []
  -        getTheme().drawGostopCard(self.windowRect, self.card_id, self.status)
  +        getTheme().drawGostopCard(self.windowRect, self.card_num)
   
       def _pyuiMouseUp(self, event):
           if not self.hit(event.pos):
  
  
  


softon      05/02/20 07:16:08

  Modified:    pyui/themes future.py
  Log:
  add gamedesktop
  
  Revision  Changes    Path
  1.3       +4 -4      simingostop2/pyui/themes/future.py
  
  Index: future.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/themes/future.py,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- future.py	19 Feb 2005 17:23:44 -0000	1.2
  +++ future.py	19 Feb 2005 22:16:08 -0000	1.3
  @@ -383,13 +383,13 @@
       #####################################################################
   
       # GostopCard methods
  -    def drawGostopCard(self, rect, card_id, status):
  +    def drawGostopCard(self, rect, card_num):
           import os
           from pyui.desktop import getRenderer
  -        if status == 1: # GostopCard.SHOW
  -            filename = 'card' + card_id + '.png'
  -        elif status == 0: #GostopCard.HIDE
  +        if card_num == -1: 
               filename = 'card51.png'
  +        else: 
  +            filename = 'card' + card_num + '.png'
                   
           imagename = os.path.join('pyui/themes/future/', filename)
           getRenderer().drawImage((rect[0], rect[1], rect[2], rect[3]), imagename)
  
  
  


softon      05/02/20 07:16:09

  Added:       pyui/themes/future card00.png card01.png card02.png
                        card03.png card04.png card05.png card06.png
                        card07.png card08.png card09.png card10.png
                        card11.png card12.png card13.png card14.png
                        card15.png card16.png card17.png card18.png
                        card19.png card20.png card21.png card22.png
                        card23.png card24.png card25.png card26.png
                        card27.png card28.png card29.png card30.png
                        card31.png card32.png card33.png card34.png
                        card35.png card36.png card37.png card38.png
                        card39.png card40.png card41.png card42.png
                        card43.png card44.png card45.png card46.png
                        card47.png card48.png card49.png card50.png
                        card51.png pan.png
  Log:
  add gamedesktop
  
  Revision  Changes    Path
  1.1                  simingostop2/pyui/themes/future/card00.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card01.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card02.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card03.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card04.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card05.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card06.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card07.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card08.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card09.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card10.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card11.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card12.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card13.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card14.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card15.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card16.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card17.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card18.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card19.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card20.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card21.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card22.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card23.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card24.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card25.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card26.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card27.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card28.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card29.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card30.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card31.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card32.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card33.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card34.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card35.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card36.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card37.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card38.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card39.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card40.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card41.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card42.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card43.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card44.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card45.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card46.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card47.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card48.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card49.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card50.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/card51.png
  
  	<<Binary file>>
  
  
  1.1                  simingostop2/pyui/themes/future/pan.png
  
  	<<Binary file>>
  
  


exman       05/02/20 07:17:14

  Modified:    .        mainlobby.py
  Log:
  κ Ʈ ߰
  
  Revision  Changes    Path
  1.2       +4 -1      simingostop2/mainlobby.py
  
  Index: mainlobby.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/mainlobby.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mainlobby.py	19 Feb 2005 21:51:16 -0000	1.1
  +++ mainlobby.py	19 Feb 2005 22:17:14 -0000	1.2
  @@ -22,6 +22,7 @@
           pyui.desktop.getRenderer().setBackMethod(self.drawBack)
           self.anim = 0.0
   
  +        self.panList = pyui.widgets.BackgroundListBox(10, 80, 363, 295)
   
           #  ̺Ʈ
           sockevt.connectEvent(sockevt.HOUSE_PANLIST, self.onPanList)
  @@ -29,7 +30,9 @@
           # ǸƮ û
           sockevt.sock.send(struct.pack("!BBH", M_HOUSE, REQUEST_HOUSE_PANLIST, 0))
       def onPanList(self, *args):
  -        print args
  +        panlist = args[0]
  +        for i in range(len(panlist)):
  +            self.panList.listbox().addItem(panlist[i][1], 0)
       def onQuit(self, event):
           desktopmanager.setPreviousDesktop()
   
  
  
  


exman       05/02/20 07:17:14

  Modified:    pyui     widgets.py
  Log:
  κ Ʈ ߰
  
  Revision  Changes    Path
  1.18      +16 -1     simingostop2/pyui/widgets.py
  
  Index: widgets.py
  ===================================================================
  RCS file: /cvsroot/simin/simingostop2/pyui/widgets.py,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- widgets.py	19 Feb 2005 22:16:08 -0000	1.17
  +++ widgets.py	19 Feb 2005 22:17:14 -0000	1.18
  @@ -2405,4 +2405,19 @@
           if self.callback:
               self.callback(self)
               return 1
  -        return 0
  \ No newline at end of file
  +        return 0
  +
  +class BackgroundListBox(Frame):
  +    def __init__(self, x, y, w, h, onClick=None, onDouble=None):
  +        Frame.__init__(self, x, y ,w, h, "listbox")
  +        self.m_listbox = ListBox(onClick, onDouble)
  +        self.setLayout( layouts.GridLayoutManager(1, 1) )
  +        self.addChild(self.m_listbox)
  +        self.pack()
  +    def draw(self, renderer):
  +        if not self.show:
  +            return
  +        self.hitList = []
  +        Window.draw(self, renderer)        
  +    def listbox(self):
  +        return self.m_listbox
  
  
  


suup        05/03/05 06:02:06

  Log:
  Status:
  
  Vendor Tag:	tcvs-vendor
  Release Tags:	tcvs-release
  
  No conflicts created by this import


suup        05/03/05 06:05:39

  Modified:    data/music lobby.ogg
  Log:
   ü!!
  
  Revision  Changes    Path
  1.5       +711 -2664 simingostop2/data/music/lobby.ogg
  
  	<<Binary file>>
  
  


suup        05/03/05 13:03:45

  Modified:    data/music lobby.ogg
  Log:
  Ҹ ~
  
  Revision  Changes    Path
  1.6       +720 -706  simingostop2/data/music/lobby.ogg
  
  	<<Binary file>>
  
  


suup        05/03/05 14:44:50

  Modified:    data/music lobby.ogg
  Log:
  Ŀ ߰, ŵ Ҹ ߰
  
  Revision  Changes    Path
  1.7       +702 -717  simingostop2/data/music/lobby.ogg
  
  	<<Binary file>>
  
  


