예제 #1
0
    def __init__(self, parent, log):
        wx.Panel.__init__(self, parent, -1)
        self.pdf = None

        sizer = wx.BoxSizer(wx.VERTICAL)
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)

        from wx.lib.flashwin import FlashWindow
        self.flash = FlashWindow(self, style=wx.SUNKEN_BORDER)

        vars = '?c=abcde12345&STATE=creator'

        url = 'http://w.digsby.com/dw.swf'  #?STATE=creator&field=ffffff&statustext=777777&nick=my.nickname&bgcolor=eaeaea&text=444444&title=Digsby+Widget&titletext=7a7a7a'
        url += vars

        self.flash.LoadMovie(0, url)
        #self.flash.LoadMovie(0, 'file://' + os.path.abspath('c:/dev/wxPython/demo/data/Asteroid_blaster.swf'))
        sizer.Add(self.flash, proportion=1, flag=wx.EXPAND)

        btn = wx.Button(self, wx.NewId(), "Open Flash File")
        self.Bind(wx.EVT_BUTTON, self.OnOpenFileButton, btn)
        btnSizer.Add(btn, proportion=1, flag=wx.EXPAND | wx.ALL, border=5)

        btn = wx.Button(self, wx.NewId(), "Open Flash URL")
        self.Bind(wx.EVT_BUTTON, self.OnOpenURLButton, btn)
        btnSizer.Add(btn, proportion=1, flag=wx.EXPAND | wx.ALL, border=5)

        btnSizer.Add((50, -1), proportion=2, flag=wx.EXPAND)
        sizer.Add(btnSizer, proportion=0, flag=wx.EXPAND)

        self.SetSizer(sizer)
        self.SetAutoLayout(True)
예제 #2
0
    def __init__(self, parent, log):
        wx.Panel.__init__(self, parent, style=0)
        self.pdf = None

        sizer = wx.BoxSizer(wx.VERTICAL)
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)

        self.flash = FlashWindow(self, style=wx.SUNKEN_BORDER)
        self.flash.LoadMovie(0, 'file://' + os.path.abspath('data/Asteroid_blaster.swf'))

        sizer.Add(self.flash, proportion=1, flag=wx.EXPAND)

        btn = wx.Button(self, wx.NewId(), "Open Flash File")
        self.Bind(wx.EVT_BUTTON, self.OnOpenFileButton, btn)
        btnSizer.Add(btn, proportion=1, flag=wx.EXPAND|wx.ALL, border=5)

        btn = wx.Button(self, wx.NewId(), "Open Flash URL")
        self.Bind(wx.EVT_BUTTON, self.OnOpenURLButton, btn)
        btnSizer.Add(btn, proportion=1, flag=wx.EXPAND|wx.ALL, border=5)

        btnSizer.Add((50,-1), proportion=2, flag=wx.EXPAND)
        sizer.Add(btnSizer, proportion=0, flag=wx.EXPAND)

        self.SetSizer(sizer)
        self.SetAutoLayout(True)
예제 #3
0
class TestPanel(wx.Panel):
    __test__ = False

    def __init__(self, parent, log):
        wx.Panel.__init__(self, parent, -1)
        self.pdf = None

        sizer = wx.BoxSizer(wx.VERTICAL)
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)

        from wx.lib.flashwin import FlashWindow
        self.flash = FlashWindow(self, style=wx.SUNKEN_BORDER)

        vars = '?c=abcde12345&STATE=creator'

        url = 'http://w.digsby.com/dw.swf'  #?STATE=creator&field=ffffff&statustext=777777&nick=my.nickname&bgcolor=eaeaea&text=444444&title=Digsby+Widget&titletext=7a7a7a'
        url += vars

        self.flash.LoadMovie(0, url)
        #self.flash.LoadMovie(0, 'file://' + os.path.abspath('c:/dev/wxPython/demo/data/Asteroid_blaster.swf'))
        sizer.Add(self.flash, proportion=1, flag=wx.EXPAND)

        btn = wx.Button(self, wx.NewId(), "Open Flash File")
        self.Bind(wx.EVT_BUTTON, self.OnOpenFileButton, btn)
        btnSizer.Add(btn, proportion=1, flag=wx.EXPAND | wx.ALL, border=5)

        btn = wx.Button(self, wx.NewId(), "Open Flash URL")
        self.Bind(wx.EVT_BUTTON, self.OnOpenURLButton, btn)
        btnSizer.Add(btn, proportion=1, flag=wx.EXPAND | wx.ALL, border=5)

        btnSizer.Add((50, -1), proportion=2, flag=wx.EXPAND)
        sizer.Add(btnSizer, proportion=0, flag=wx.EXPAND)

        self.SetSizer(sizer)
        self.SetAutoLayout(True)

    def OnOpenFileButton(self, event):
        dlg = wx.FileDialog(self, wildcard="*.swf")

        if dlg.ShowModal() == wx.ID_OK:
            wx.BeginBusyCursor()
            self.flash.LoadMovie(0, 'file://' + dlg.GetPath())
            wx.EndBusyCursor()

        dlg.Destroy()

    def OnOpenURLButton(self, event):
        dlg = wx.TextEntryDialog(self, "Enter a URL of a .swf file",
                                 "Enter URL")

        if dlg.ShowModal() == wx.ID_OK:
            wx.BeginBusyCursor()
            # setting the movie property works too
            self.flash.movie = dlg.GetValue()
            wx.EndBusyCursor()

        dlg.Destroy()
예제 #4
0
class TestPanel(wx.Panel):
    def __init__(self, parent, log):
        wx.Panel.__init__(self, parent, style=0)
        self.pdf = None

        sizer = wx.BoxSizer(wx.VERTICAL)
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)

        self.flash = FlashWindow(self, style=wx.SUNKEN_BORDER)
        self.flash.LoadMovie(0, 'file://' + os.path.abspath('data/Asteroid_blaster.swf'))

        sizer.Add(self.flash, proportion=1, flag=wx.EXPAND)

        btn = wx.Button(self, wx.NewId(), "Open Flash File")
        self.Bind(wx.EVT_BUTTON, self.OnOpenFileButton, btn)
        btnSizer.Add(btn, proportion=1, flag=wx.EXPAND|wx.ALL, border=5)

        btn = wx.Button(self, wx.NewId(), "Open Flash URL")
        self.Bind(wx.EVT_BUTTON, self.OnOpenURLButton, btn)
        btnSizer.Add(btn, proportion=1, flag=wx.EXPAND|wx.ALL, border=5)

        btnSizer.Add((50,-1), proportion=2, flag=wx.EXPAND)
        sizer.Add(btnSizer, proportion=0, flag=wx.EXPAND)

        self.SetSizer(sizer)
        self.SetAutoLayout(True)



    def OnOpenFileButton(self, event):
        dlg = wx.FileDialog(self, wildcard="*.swf")

        if dlg.ShowModal() == wx.ID_OK:
            wx.BeginBusyCursor()
            self.flash.LoadMovie(0, 'file://' + dlg.GetPath())
            wx.EndBusyCursor()

        dlg.Destroy()


    def OnOpenURLButton(self, event):
        dlg = wx.TextEntryDialog(self, "Enter a URL of a .swf file", "Enter URL")

        if dlg.ShowModal() == wx.ID_OK:
            wx.BeginBusyCursor()
            # setting the movie property works too
            self.flash.movie = dlg.GetValue()
            wx.EndBusyCursor()

        dlg.Destroy()
예제 #5
0
class _FlashEditor(Editor):
    """Traits UI Flash editor."""

    # -------------------------------------------------------------------------
    #  Trait definitions:
    # -------------------------------------------------------------------------

    #: Is the table editor is scrollable? This value overrides the default.
    scrollable = True

    def init(self, parent):
        """Finishes initializing the editor by creating the underlying toolkit
        widget.
        """
        self.control = FlashWindow(parent)
        self.set_tooltip()

    def update_editor(self):
        """Updates the editor when the object trait changes externally to the
        editor.
        """
        value = self.str_value.strip()
        if value.find("://") < 0:
            value = "file://" + value

        wx.BeginBusyCursor()
        self.control.LoadMovie(0, value)
        wx.EndBusyCursor()
예제 #6
0
 def __init__(self, parent=None):
     gui.form_ui.__init__(self, parent)
     self.t_likes.SetLabel("0")
     if wx.Platform == '__WXMSW__':
         from wx.lib.flashwin import FlashWindow
         self.flash = FlashWindow(self, style=wx.SUNKEN_BORDER)
         self.canvas.Add(self.flash, proportion=1, flag=wx.EXPAND, border=5)
     self.conn = connect("wanga_detail.db")
     self.curs = self.conn.cursor()
     self.gamelist.InsertColumn(0, u'序号', width=50)
     w = self.gamelist.GetSizeTuple()[0]  #width of listctrl
     self.gamelist.InsertColumn(1, u'游戏名', width=w - 75)
     self.gamelist.InsertColumn(2, 'id', width=0)
     self.gamelist.InsertColumn(3, 'src', width=0)
     self.update_list(
         self.curs.execute('select name,id,src,likes from gamelist'))
예제 #7
0
    def __init__(self, parent):

        self.parent = parent
        self.mediaPlayer = FlashWindow(parent.pa_flash_player,
                                       style=wx.NO_BORDER,
                                       size=wx.Size(500, 140))
        self.paused = False
예제 #8
0
    def __init__(self, parent, id):
        wx.Panel.__init__(self, parent, -1)
        self.pdf = None

        sizer = wx.BoxSizer(wx.VERTICAL)
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)

        self.flash = FlashWindow(self, style=wx.SUNKEN_BORDER)
        sizer.Add(self.flash, proportion=1, flag=wx.EXPAND)

        btn = wx.Button(self, wx.NewId(), "Open a Flash File")
        self.Bind(wx.EVT_BUTTON, self.OnOpenFileButton, btn)
        btnSizer.Add(btn, proportion=1, flag=wx.EXPAND | wx.ALL, border=5)

        btn = wx.Button(self, wx.NewId(), "Open a Flash URL")
        self.Bind(wx.EVT_BUTTON, self.OnOpenURLButton, btn)
        btnSizer.Add(btn, proportion=1, flag=wx.EXPAND | wx.ALL, border=5)

        btnSizer.Add((50, -1), proportion=2, flag=wx.EXPAND)
        sizer.Add(btnSizer, proportion=0, flag=wx.EXPAND)

        self.SetSizer(sizer)
        self.SetAutoLayout(True)
class MyPanel(wx.Panel):
    def __init__(self, parent, id):
        wx.Panel.__init__(self, parent, -1)
        self.pdf = None

        sizer = wx.BoxSizer(wx.VERTICAL)
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)

        self.flash = FlashWindow(self, style=wx.SUNKEN_BORDER)
        sizer.Add(self.flash, proportion=1, flag=wx.EXPAND)

        btn = wx.Button(self, wx.NewId(), "Open a Flash File")
        self.Bind(wx.EVT_BUTTON, self.OnOpenFileButton, btn)
        btnSizer.Add(btn, proportion=1, flag=wx.EXPAND | wx.ALL, border=5)

        btn = wx.Button(self, wx.NewId(), "Open a Flash URL")
        self.Bind(wx.EVT_BUTTON, self.OnOpenURLButton, btn)
        btnSizer.Add(btn, proportion=1, flag=wx.EXPAND | wx.ALL, border=5)

        btnSizer.Add((50, -1), proportion=2, flag=wx.EXPAND)
        sizer.Add(btnSizer, proportion=0, flag=wx.EXPAND)

        self.SetSizer(sizer)
        self.SetAutoLayout(True)

    def OnOpenFileButton(self, event):
        # make sure you have flash files available on drive
        # dlg = wx.FileDialog(self, wildcard="*.swf")
        dlg = wx.FileDialog(self)

        if dlg.ShowModal() == wx.ID_OK:
            wx.BeginBusyCursor()
            self.flash.LoadMovie(0, 'file://' + dlg.GetPath())
            wx.EndBusyCursor()
        dlg.Destroy()

    def OnOpenURLButton(self, event):
        # you can retrieve flash files from internet too
        dlg = wx.TextEntryDialog(self, "Enter a URL of a .swf file",
                                 "Enter URL")
        if dlg.ShowModal() == wx.ID_OK:
            wx.BeginBusyCursor()
            # setting the movie property works too
            self.flash.movie = dlg.GetValue()
            wx.EndBusyCursor()
        dlg.Destroy()
예제 #10
0
    def __init__(self, parent, pathToPlugins=None):
        if (not pathToPlugins == None):
            RESFILE = os.path.join(pathToPlugins,
                                   'dizzler') + os.sep + "layout_dizzler.xml"
            DIZZLER = os.path.join(pathToPlugins, 'dizzler') + os.sep
            DIZZLER_SETTINGS = os.path.join(
                pathToPlugins, 'dizzler') + os.sep + "settings_dizzler.xml"

        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           "Dizzler",
                           size=(475, 310),
                           style=wx.FRAME_SHAPED)  #STAY_ON_TOP)
        self.parent = parent

        # XML Resources can be loaded from a file like this:
        res = xrc.XmlResource(RESFILE)

        # Now create a panel from the resource data
        panel = res.LoadPanel(self, "m_pa_plugin_dizzler")

        # control references --------------------
        self.pa_dizzler_player = xrc.XRCCTRL(self, 'm_pa_dizzler_player')
        #header for dragging and moving
        self.st_dizzler_header = xrc.XRCCTRL(self, 'm_st_dizzler_header')
        self.st_dizzler_using = xrc.XRCCTRL(self, 'm_st_dizzler_using')
        self.bm_dizzler_close = xrc.XRCCTRL(self, 'm_bm_dizzler_close')

        # bindings ----------------
        self.Bind(wx.EVT_BUTTON,
                  self.SetDizzler,
                  id=xrc.XRCID('m_bu_dizzler_use_dizzler'))
        self.Bind(wx.EVT_BUTTON,
                  self.SetGrooveShark,
                  id=xrc.XRCID('m_bu_dizzler_use_grooveshark'))
        #self.Bind(wx.EVT_TEXT, self.OnChars, self.tc_dizzler_text)
        self.bm_dizzler_close.Bind(wx.EVT_LEFT_UP, self.CloseMe)

        self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseLeftDown)
        self.Bind(wx.EVT_MOTION, self.OnMouseMotion)
        self.Bind(wx.EVT_LEFT_UP, self.OnMouseLeftUp)
        self.Bind(wx.EVT_RIGHT_UP, self.OnRightUp)
        self.st_dizzler_header.Bind(wx.EVT_LEFT_DOWN, self.OnMouseLeftDown)
        self.st_dizzler_header.Bind(wx.EVT_MOTION, self.OnMouseMotion)
        self.st_dizzler_header.Bind(wx.EVT_LEFT_UP, self.OnMouseLeftUp)
        self.st_dizzler_header.Bind(wx.EVT_RIGHT_UP, self.OnRightUp)

        self.st_dizzler_using.SetLabel('Using: ' + self.parent.web_music_type)

        #self.bu_update_restart.Enable(False)
        # set layout --------------
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(panel, 1, wx.EXPAND | wx.ALL, 5)
        self.SetSizer(sizer)
        self.SetAutoLayout(True)
        #self.LoadSetings()

        #flash windows
        self.dizzler_flash = FlashWindow(self.pa_dizzler_player,
                                         style=wx.NO_BORDER,
                                         size=wx.Size(
                                             500, 140))  #, size=(400, 120))
        #self.flash.Show(True)

        flash_sizer = wx.BoxSizer(wx.VERTICAL)
        flash_sizer.Add(self.dizzler_flash, 1, wx.EXPAND | wx.ALL, 5)
        self.pa_dizzler_player.SetSizer(flash_sizer)

        self.parent.use_web_music = True
        self.parent.flash = self.dizzler_flash
예제 #11
0
 def init(self, parent):
     """Finishes initializing the editor by creating the underlying toolkit
     widget.
     """
     self.control = FlashWindow(parent)
     self.set_tooltip()
예제 #12
0
    def __init__(self, parent, date):

        wx.Frame.__init__(self, parent, name='FrameCompare',
                          title=u"查看过滤数据", pos=wx.DefaultPosition,
                          size=(568, 330),
                          style=wx.SYSTEM_MENU | wx.CAPTION \
                          |  wx.CLOSE_BOX | wx.CLIP_CHILDREN)
        self.SetIcon(wx.Icon(u'pic/red.ico',wx.BITMAP_TYPE_ICO))
        #命令行提示
        print (u'FrameCompare启动').encode(locale.getdefaultlocale()[1])

        # Create a Panel
        panel = wx.Panel(self, -1)

        # Data definition
        self.fileList = []
        self.panels = []
        self.flash = []
        # Get all datas(embedded '被滤数据')
        if '%d'%(date+1) in os.listdir(os.curdir):
            for ts in os.listdir('%d'%(date+1)):
                if (u'被滤数据').encode(locale.getdefaultlocale()[1]) in ts:
                    self.fileList.append(ts)

        if len(self.fileList)==0:
            wx.StaticText(panel, -1, u"对不起,未在%d目录下发现被滤数据!\n或者不存在%d目录!"%(date+1,date+1), \
                          pos=(20, 34))
        elif wx.Platform!='__WXMSW__':
            wx.StaticText(panel, -1, u"对不起,您的系统不支持Flash控件!\n该功能只在Windows下可用。", \
                          pos=(20, 34))
        else:
            from wx.lib.flashwin import FlashWindow

            # Create an ImageList
            imagelist = wx.ImageList(32,32)        
            # Get a pic 
            bmp = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, (32,32))
            # Add image to ImageList
            imagelist.Add(bmp)       
            # Create a Listbook
            listBook = wx.Listbook(panel, -1, style=wx.BK_DEFAULT)                             
            # Listbook's imagelist assign
            listBook.AssignImageList(imagelist)
            # Circle create pages
            for i in range(0, len(self.fileList)):
                # Create a Panel, and add to panels[]
                self.panels.append(wx.Panel(listBook, -1))
                # Read file
                f = open('%d/%s'%(date+1,self.fileList[i]), 'r')
                s = f.read()
                f.close()
                # Flash
                self.flash.append(FlashWindow(self.panels[i], style=wx.SUNKEN_BORDER))
                self.flash[i].LoadMovie(0, os.path.abspath(u'pic/flashC.swf'))
                self.boxSizer1 = wx.BoxSizer(orient=wx.VERTICAL)
                self.boxSizer1.Add(self.flash[i], proportion=1, flag=wx.EXPAND)
                self.boxSizer1.SetDimension(0, 0, 538, 340) 
                self.panels[i].SetSizer(self.boxSizer1)
                self.flash[i].SetVariable("fdata_max", len(s)/18)
                self.flash[i].SetVariable("fdata_str", s)
                # Add page to listbook
                listBook.AddPage(self.panels[i], self.fileList[i], imageId=0)       
            # Sizer
            sizer = wx.BoxSizer()
            sizer.Add(listBook, 1, wx.EXPAND)
            panel.SetSizer(sizer)
예제 #13
0
class Form(gui.form_ui):
    def __init__(self, parent=None):
        gui.form_ui.__init__(self, parent)
        self.t_likes.SetLabel("0")
        if wx.Platform == '__WXMSW__':
            from wx.lib.flashwin import FlashWindow
            self.flash = FlashWindow(self, style=wx.SUNKEN_BORDER)
            self.canvas.Add(self.flash, proportion=1, flag=wx.EXPAND, border=5)
        self.conn = connect("wanga_detail.db")
        self.curs = self.conn.cursor()
        self.gamelist.InsertColumn(0, u'序号', width=50)
        w = self.gamelist.GetSizeTuple()[0]  #width of listctrl
        self.gamelist.InsertColumn(1, u'游戏名', width=w - 75)
        self.gamelist.InsertColumn(2, 'id', width=0)
        self.gamelist.InsertColumn(3, 'src', width=0)
        self.update_list(
            self.curs.execute('select name,id,src,likes from gamelist'))

    def set(self, event):
        pass

    def update_list(self, ans):
        n = ans.fetchall()
        line = 0
        self.gamelist.DeleteAllItems()
        for item in n:
            self.gamelist.InsertStringItem(line, str(line + 1))
            self.gamelist.SetStringItem(line, 1, item[0])
            self.gamelist.SetStringItem(line, 2, str(item[1]))
            self.gamelist.SetStringItem(line, 3, item[2])
            line = line + 1

    def search(self, event):
        q1 = '%' + self.t_name.GetValue() + '%'
        q2 = '%' + self.t_tag.GetValue() + '%'
        q3 = '%' + self.t_type.GetValue() + '%'
        cmd='select name,id,src,likes from gamelist '\
        'where name like ? and tag like ? and type like ?;'
        self.update_list(self.curs.execute(cmd, (q1, q2, q3)))

    def likes(self, event):
        n = int(self.t_likes.GetLabel())
        self.t_likes.SetLabel("%d" % (n + 1))
        pass

    def run_game(self, event):
        pass

    def show_msg(self, event):
        n = event.m_itemIndex
        id = self.gamelist.GetItem(n, 2).GetText()
        src = self.gamelist.GetItem(n, 3).GetText()
        s = "id:%s\nsrc:%s" % (id, src)
        self.m_msg.SetValue(s)
        swfname = os.path.basename(s)
        fullname = os.path.join(sys.path[0], datadir, swfname)
        if os.path.exists(fullname):
            src = fullname
            print(src)
        else:
            cache_grab.grab_file(swfname, datadir)
        self.flash.LoadMovie(0, src)