Exemplo n.º 1
0
Arquivo: Gui.py Projeto: elmom/pypsyc
	def __init__(self, parent, ID, title, pos=wxDefaultPosition, size=wxSize(190, 400), style=wxDEFAULT_FRAME_STYLE):
		wxFrame.__init__(self, parent, ID, title, pos , size, style)
		
		# menubar, statusbar et al
		self.CreateStatusBar()
		self.SetStatusText("welcome to pyPSYC")
		menu = wxMenu()
		menu.Append(ID_CONNECT, "&Connect", "connect to the net")
		menu.Append(ID_ABOUT, "&About", "tritratrullala")
		menu.AppendSeparator()
		menu.Append(ID_EXIT, "&Exit", "leave us")
		menuBar = wxMenuBar()
		menuBar.Append(menu, "&File");
		self.SetMenuBar(menuBar)
	
		
		##'buddy' list, perhaps ;]]
		self.SampleList= []
		self.buddylist_dict ={}
		#self.BuddyList = wxListBox(self , ID_BUDDY_LIST,style=wxLB_NEEDED_SB|wxLB_SINGLE, choices=self.SampleList)
		self.BuddyList = wxListCtrl(self, ID_BUDDY_LIST, style=wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER)
		self.BuddyList.InsertColumn(0, "ST")
		self.BuddyList.InsertColumn(1, "Nick")# , wxLIST_FORMAT_RIGHT)
		self.BuddyList.SetColumnWidth(0, 20)
		##end buddy list
		
		# define the buttons and so on at the bottom of the window 
		self.status = wxComboBox(self, ID_STATUS, "", choices=["", "This", "is a", "Place", "to put commands"], size=(150,-1), style=wxCB_DROPDOWN)
		self.menu_button = wxButton( self, ID_MENU, 'pyPSYC')
		self.exit_button = wxButton( self, ID_EXIT, 'exit')
		self.con_menu = wxBoxSizer(wxHORIZONTAL)
		self.con_menu.Add(self.menu_button, 1, wxALIGN_BOTTOM)
		self.con_menu.Add(self.exit_button, 1, wxALIGN_BOTTOM)
		
		sizer = wxFlexGridSizer(3, 0 , 0,0)
		sizer.Add(self.BuddyList, 1, wxGROW)
		sizer.Add(self.con_menu, 1,wxGROW)
		sizer.Add(self.status, 1,wxGROW)
		sizer.AddGrowableRow(0)
		sizer.AddGrowableCol(0)
		# do somethign so that the buttons don't vanish in a too small window
		# this is h4x0r-style but does the job at the moment
		sizer.SetItemMinSize(self.BuddyList, 30, 10)
		sizer.SetMinSize(wxSize(200,280))
		self.SetSizer(sizer)
		self.SetAutoLayout(true)
		##dunno where to put it at the moment,but believe it shouldn't be here
		# wir machen uns ne instanz von dem fenster wo alle chats rein kommen sollen
		self.extrawin = TabBook(self, -1, "blah blubb", size=(800, 400), style = wxDEFAULT_FRAME_STYLE)
		# für buddy auswahl
		self.currentBuddy = 0

		# event handling
		EVT_BUTTON( self, ID_EXIT, self.onExit )
		EVT_BUTTON(self, ID_CONNECT, self.doConnect)
		EVT_BUTTON(self, ID_CLOSECHATNOTE, self.closeChat)
		EVT_MENU( self, ID_EXIT, self.onExit)
		EVT_MENU(self, ID_CONNECT, self.doConnect)
		##EVT_LEFT_DCLICK(self.BuddyList,  self.onFriend)
		EVT_LIST_ITEM_SELECTED(self, ID_BUDDY_LIST, self.OnBuddySelected)
		# ect_activated muß weg sosnt wird zweimal nen chat geöffnet ;]]
		EVT_LIST_ITEM_ACTIVATED(self, ID_BUDDY_LIST, self.onFriend)
Exemplo n.º 2
0
    def __init__(self, parent=None, ID=0, title='pyPSYC', center=None, config=None, pos=wxDefaultPosition, size=wxSize(190, 400), style=wxDEFAULT_FRAME_STYLE):
        # bei mir is friendlist, firendlist und maingui in einem
        # zumindestens sollte es das sein ob es so klappt weiss ich noch nicht
        self.global_config = config
        self.config = ConfigParser.ConfigParser()  
        self.config.read(CONFIG_FILE)
        
        if self.config:
            pos = split(self.config.get('gui', 'wx_friend_pos'), ',')
            size = split(self.config.get('gui', 'wx_friend_size'), ',')
            
        wxFrame.__init__(self, parent, ID, title, wxPoint(int(pos[0]), int(pos[1])) , wxSize(int(size[0]), int(size[1])), style)
        PSYCPackage.__init__(self)
        self.currentBuddy = None
        self.center = center
        self.model = None
        self.packagename = "Friends gui"
        # we have to register by ourselves
        # perhaps it's not the way to do it but it works
# no.. it's not working.. --lynX
#       self.center.register(FriendsPackage(self))

        # menubar, statusbar et al
        self.CreateStatusBar()
        self.SetStatusText("welcome to pyPSYC")
        menu = wxMenu()
        menu.Append(ID_CONNECT, "&Connect", "connect to the net")
        menu.Append(ID_ABOUT, "&About", "tritratrullala")
        menu.AppendSeparator()
        menu.Append(ID_EXIT, "&Exit", "leave us")
        menuBar = wxMenuBar()
        menuBar.Append(menu, "&File");
        self.SetMenuBar(menuBar)

        ##'buddy' list, perhaps ;]]
        self.BuddyList = wxListCtrl(self, ID_BUDDY_LIST, style=wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER)
        self.BuddyList.InsertColumn(0, "ST")
        self.BuddyList.InsertColumn(1, "Nick")# , wxLIST_FORMAT_RIGHT)
        self.BuddyList.SetColumnWidth(0, 20)
        ##end buddy list
        
        # define the buttons and so on at the bottom of the window 
        self.status = wxComboBox(self, ID_STATUS, "", choices=["", "This", "is a", "Place", "to put commands"], size=(150,-1), style=wxCB_DROPDOWN)
        self.menu_button = wxButton( self, ID_MENU, 'pyPSYC')
        self.exit_button = wxButton( self, ID_EXIT, 'exit')
        self.con_menu = wxBoxSizer(wxHORIZONTAL)
        self.con_menu.Add(self.menu_button, 1, wxALIGN_BOTTOM)
        self.con_menu.Add(self.exit_button, 1, wxALIGN_BOTTOM)
        
        sizer = wxFlexGridSizer(3, 0 , 0,0)
        sizer.Add(self.BuddyList, 1, wxGROW)
        sizer.Add(self.con_menu, 1,wxGROW)
        sizer.Add(self.status, 1,wxGROW)
        sizer.AddGrowableRow(0)
        sizer.AddGrowableCol(0)
        # do something so that the buttons don't vanish in a too small window
        # this is h4x0r-style but does the job at the moment
        sizer.SetItemMinSize(self.BuddyList, 30, 10)
        sizer.SetMinSize(wxSize(200,280))
        self.SetSizer(sizer)
        self.SetAutoLayout(true)

        # event handling
        EVT_BUTTON( self, ID_EXIT, self.onExit )
        EVT_BUTTON( self, ID_MENU, self.doConnect )
        #EVT_BUTTON(self, ID_CONNECT, self.doConnect)
        #EVT_BUTTON(self, ID_CLOSECHATNOTE, self.closeChat)
        EVT_MENU( self, ID_EXIT, self.onExit)
        EVT_MENU(self, ID_CONNECT, self.doConnect)