def InitCardLists(self, p): listY = 424 BUTTON_WIDTH = 100 LIST_WIDTH = (self.BOX_WIDTH - BUTTON_WIDTH - 32) / 2 listX = self.FRAME_MARGIN self.lvCardList = wx.ListView( p, -1, (listX, listY), (LIST_WIDTH, 220), wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.VSCROLL | wx.LC_NO_HEADER) self.lvCardList.InsertColumn(0, "Name:", width=152) self.lvCardList.InsertColumn(1, "Set:", width=48) invX = self.FRAME_MARGIN + self.BOX_WIDTH - LIST_WIDTH self.lvInvList = wx.ListView( p, -1, (invX, listY), (LIST_WIDTH, 220), wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.VSCROLL | wx.LC_NO_HEADER) self.lvInvList.InsertColumn(0, "Name:", width=130) self.lvInvList.InsertColumn(1, "Set:", width=48) self.lvInvList.InsertColumn(2, "#:", width=24) self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnSelInvList, self.lvInvList) listRight = listX + LIST_WIDTH buttonMargin = (invX - listRight - wx.Button.GetDefaultSize()[0]) / 2 buttonX = listRight + buttonMargin self.btnAddCard = wx.Button(p, -1, "Add Card", (buttonX, listY + 54)) self.btnAddCard.SetDefault() self.Bind(wx.EVT_BUTTON, self.OnAddCard, self.btnAddCard) self.btnDelCard = wx.Button(p, -1, "Delete Card", (buttonX, listY + 96)) self.Bind(wx.EVT_BUTTON, self.OnDelCard, self.btnDelCard) self.OnVisTainted(None)
def __init__(self, parent, id, name="", size=wx.DefaultSize, pos=wx.DefaultPosition, columnNames=[], rows=[], timeStampAttributeFullName="", currentTimeStamp=None, timeStampSelectedCallback=None, timeStampActivatedCallback=None, pageLinkName=""): wx.Panel.__init__(self, parent, id, name=name, size=size, pos=pos) self.timeStampSelectedCallback = timeStampSelectedCallback self.timeStampActivatedCallback = timeStampActivatedCallback self.timeStampAttributeFullName = timeStampAttributeFullName self.pageLinkName = pageLinkName self.currentTimeStamp = currentTimeStamp vbox = wx.BoxSizer(wx.VERTICAL) hbox = wx.BoxSizer(wx.HORIZONTAL) columnWidth = size[0] / len(columnNames) - 3 self.historyList = wx.ListView(self, -1, size=size) for c, columnName in enumerate(columnNames): self.historyList.InsertColumn(c, columnName) self.historyList.SetColumnWidth(c, columnWidth) self.timeStampList = [] for r, row in enumerate(rows): # print 'R:',r # print 'ROW:',row # print 'columnNames:',columnNames self.historyList.InsertStringItem(r, '') self.timeStampList.append(row['timeStamp']) for c, columnName in enumerate(columnNames): # print 'A C:',c # print 'A columnName:',columnName # print 'A row:',row self.historyList.SetStringItem(r, c, row[columnName]) hbox.Add(self.historyList) vbox.Add(hbox) self.SetSizer(vbox) index = None try: index = self.timeStampList.index(currentTimeStamp) except BaseException, e: print e
def init_controls(self): self.label = wx.StaticText(self, wx.ID_ANY, "Amplifier list:") throbber_bitmap = wx.ArtProvider.GetBitmap("amp-launcher-throbber", wx.ART_OTHER) self.throbber = throbber.Throbber(self, -1, bitmap=throbber_bitmap, frames=4, frameWidth=43) self.amp_list = wx.ListView(self, wx.ID_ANY) self.amp_list.InsertColumn(0, "address") self.amp_list.InsertColumn(1, "experiment") self.amp_list.InsertColumn(2, "amplifier") self.amp_list.InsertColumn(3, "status") self.refresh_amp_info()
def __init__(self, *args, **kwds): self.log = logging.getLogger("com.fussyware.edproxy"); self.log.setLevel(logging.DEBUG) # begin wxGlade: EDProxyFrame.__init__ kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.CLIP_CHILDREN wx.Frame.__init__(self, *args, **kwds) menu_bar = wx.MenuBar() settings_menu = wx.Menu() self._import_menu = settings_menu.Append(wx.ID_ANY, "&Import\tCTRL+I") pref_menu = settings_menu.Append(wx.ID_PREFERENCES, "&Preferences\tCTRL+,", "Configure Edproxy Settings.") about_menu = settings_menu.Append(wx.ID_ABOUT, "&About", "About Edproxy") exit_menu = settings_menu.Append(wx.ID_EXIT, "&Exit", "Exit Edproxy.") menu_bar.Append(settings_menu, "&File") self.SetMenuBar(menu_bar) self._import_menu.Enable(False) self.start_button = wx.Button(self, wx.ID_ANY, _("Start")) self.stop_button = wx.Button(self, wx.ID_ANY, _("Stop")) self.client_listview = wx.ListView(self, style = wx.LC_REPORT | wx.BORDER_SUNKEN) self.plugin_listview = wx.ListView(self, style = wx.LC_REPORT | wx.BORDER_SUNKEN) self.__set_properties() self.__do_layout() self.Bind(wx.EVT_MENU, self.__on_import_menu, self._import_menu) self.Bind(wx.EVT_MENU, self.__on_pref_menu, pref_menu) self.Bind(wx.EVT_MENU, self.__on_exit_menu, exit_menu) self.Bind(wx.EVT_MENU, self.__on_about_menu, about_menu) self.Bind(wx.EVT_BUTTON, self.on_start, self.start_button) self.Bind(wx.EVT_BUTTON, self.on_stop, self.stop_button) # end wxGlade self.Bind(wx.EVT_CLOSE, self.on_win_close) self._edconfig = edconfig.get_instance() wx.CallLater(10, self.__finish_init_thread)
def __init__(self, parent): super(InfoBar, self).__init__(parent, style=wx.SUNKEN_BORDER) self.dbName = '' # Pane for the information self.variables = wx.CollapsiblePane(self) self.graphs = wx.CollapsiblePane(self) self.lvVariables = wx.ListView(self) self.lvGraphs = wx.ListView(self) self.lvVariables.InsertColumn(0, "Name") self.lvVariables.InsertColumn(1, "Type/Description") self.lvGraphs.InsertColumn(0, " ") self.lvGraphs.InsertColumn(1, " ") self.lvGraphs.InsertColumn(2, " ") self.SetBackgroundColour((255, 255, 255)) self.groupCtrls()
def __init__(self, parent, project): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title='Edit Project', size=wx.Size(650, 535), style=wx.DEFAULT_DIALOG_STYLE) Layout = wx.BoxSizer(wx.VERTICAL) self.SlugLabel = wx.StaticText(self, wx.ID_ANY, 'Slug', wx.DefaultPosition, wx.DefaultSize, 0) self.SlugLabel.Wrap(-1) Layout.Add(self.SlugLabel, 0, wx.TOP | wx.LEFT, 10) self.SlugInput = wx.TextCtrl(self, wx.ID_ANY, project.get('slug', ''), wx.DefaultPosition, wx.DefaultSize, 0) Layout.Add(self.SlugInput, 0, wx.ALL | wx.EXPAND, 10) self.SolutionLabel = wx.StaticText(self, wx.ID_ANY, 'Solution', wx.DefaultPosition, wx.DefaultSize, 0) self.SolutionLabel.Wrap(-1) Layout.Add(self.SolutionLabel, 0, wx.TOP | wx.LEFT, 10) self.SolutionPicker = wx.FilePickerCtrl(self, wx.ID_ANY, project.get('solution', ''), 'Select solution file') Layout.Add(self.SolutionPicker, 0, wx.ALL | wx.EXPAND, 5) wx.Window(self, pos=(10, 147), size=(630, 326), style=wx.SUNKEN_BORDER) self.AddonList = wx.ListView(self, style=wx.LC_SINGLE_SEL | wx.LC_REPORT) Layout.Add(self.AddonList, 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 11) self.AddAddon = Cocoa.LightPlus(self) self.RemoveAddon = Cocoa.LightMinus(self, pos=(32, 482)) Layout.Add(self.AddAddon, 0, wx.ALL, 10) self.SetSizer(Layout) self.Layout() self.Center() self.project = project self.AddonList.InsertColumn(0, 'Folders', width=self.AddonList.GetSize()[0]) self.UpdateList() self.SlugInput.Bind(wx.EVT_TEXT, self.OnSlugSet) self.SolutionPicker.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnSolutionSet) self.RemoveAddon.Bind(wx.EVT_BUTTON, self.OnRemove) self.AddAddon.Bind(wx.EVT_BUTTON, self.OnAdd)
def displayProcesses(self): if not self.processesPage: self.processesPage = wx.ListView(self.notebook, -1, style=wx.LC_LIST | wx.LC_ALIGN_TOP) self.notebook.AddPage(self.processesPage, self.processesText, False, self.processesImgIdx) else: pageIdx = self.findPage(self.processesText) if pageIdx != -1: self.notebook.SetSelection(pageIdx)
def _init_ctrls(self, prnt): # generated method, don't edit wx.Dialog.__init__(self, id=wxID_PYINTERPRETERCHOOSERDLG, name='PyInterpreterChooserDlg', parent=prnt, pos=wx.Point(548, 354), size=wx.Size(532, 358), style=wx.RESIZE_BORDER | wx.DEFAULT_DIALOG_STYLE, title=_('Python Interpreter Chooser')) self._init_utils() self.SetClientSize(wx.Size(524, 331)) self.Center(wx.BOTH) self.staticText1 = wx.StaticText(id=wxID_PYINTERPRETERCHOOSERDLGSTATICTEXT1, label=_('Found installations: (double click to select)'), name='staticText1', parent=self, pos=wx.Point(10, 10), size=wx.Size(203, 13), style=0) self.gdcInstallPath = wx.GenericDirCtrl(defaultFilter=0, dir='.', filter=self.installPathFilter, id=wxID_PYINTERPRETERCHOOSERDLGGDCINSTALLPATH, name='gdcInstallPath', parent=self, pos=wx.Point(272, 52), size=wx.Size(242, 146), style=wx.DIRCTRL_SHOW_FILTERS | wx.DIRCTRL_3D_INTERNAL | wx.NO_BORDER) self.lcInstallations = wx.ListView(id=wxID_PYINTERPRETERCHOOSERDLGLCINSTALLATIONS, name='lcInstallations', parent=self, pos=wx.Point(10, 52), size=wx.Size(242, 146), style=wx.SUNKEN_BORDER | wx.LC_REPORT, validator=wx.DefaultValidator) self._init_coll_lcInstallations_Columns(self.lcInstallations) self.lcInstallations.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnLcinstallationsListItemActivated, id=wxID_PYINTERPRETERCHOOSERDLGLCINSTALLATIONS) self.staticText2 = wx.StaticText(id=wxID_PYINTERPRETERCHOOSERDLGSTATICTEXT2, label=_('Current interpreter path (Blank means sys.executable will be used.)'), name='staticText2', parent=self, pos=wx.Point(10, 218), size=wx.Size(504, 19), style=0) self.txtPyIntpPath = wx.TextCtrl(id=wxID_PYINTERPRETERCHOOSERDLGTXTPYINTPPATH, name='txtPyIntpPath', parent=self, pos=wx.Point(10, 257), size=wx.Size(504, 21), style=0, value=self.pythonInterpreterPath) self.btnOK = wx.Button(id=wx.ID_OK, label=_('OK'), name='btnOK', parent=self, pos=wx.Point(287, 298), size=wx.Size(101, 23), style=0) self.btnCancel = wx.Button(id=wx.ID_CANCEL, label=_('Cancel'), name='btnCancel', parent=self, pos=wx.Point(408, 298), size=wx.Size(106, 23), style=0) self._init_sizers()
def __makeListCtrl(self): """Make the list control""" # LStyle = wx.LC_REPORT # listctrl = wx.ListView(self, wx.NewId(), style=LStyle) listctrl.InsertColumn(0, 'HKL') listctrl.InsertColumn(1, 'd-spacing') listctrl.InsertColumn(2, '2-theta (deg)') listctrl.SetColumnWidth(0, 200) listctrl.SetColumnWidth(1, wx.LIST_AUTOSIZE_USEHEADER) listctrl.SetColumnWidth(2, wx.LIST_AUTOSIZE_USEHEADER) # # Now add HKLs # pdat = self.mat.planeData hkls = pdat.hklDataList # property excl = pdat.exclusions print 'exclusions:\n', excl print len(hkls) print hkls[0] n = pdat.getNhklRef() for i in range(n): hklData = hkls[i] hkl = hklData['hkl'] hklStr = '(%d, %d, %d)' % (hkl[0], hkl[1], hkl[2]) index = listctrl.InsertStringItem(sys.maxint, hklStr) dspace = '%.6g' % hklData['dSpacings'] tth = hklData['tTheta'] * (180 / math.pi) tTheta = '%.6g' % tth listctrl.SetStringItem(index, 1, dspace) listctrl.SetStringItem(index, 2, tTheta) # # Show exclusions by background color # if excl[i]: listctrl.SetItemBackgroundColour(index, 'grey') pass pass # # Save certain data # self.nhkls = n self.hkls = hkls self.exclude = excl return listctrl
def _createControls(self): # A Statusbar in the bottom of the window self.CreateStatusBar(1) sMsg = 'wxPython ' + wx.version() self.SetStatusText(sMsg) # Add a panel to the frame (needed under Windows to have a nice background) pnl = wx.Panel(self, wx.ID_ANY) szrMain = wx.BoxSizer(wx.VERTICAL) self._lstResults = wx.ListView(pnl, wx.ID_ANY) self._lstResults.AppendColumn('Name', wx.LIST_FORMAT_RIGHT) self._lstResults.AppendColumn('Value') szrMain.Add(self._lstResults, 1, wx.ALL | wx.EXPAND, 5) pnl.SetSizer(szrMain)
def __init__(self, parent, id, title, col_labels, data={}, config_name=None, style=wx.CAPTION|wx.MAXIMIZE_BOX| \ wx.SYSTEM_MENU|wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER): wx.Dialog.__init__(self, parent, id=id, title=title, style=style) self.__col_labels=col_labels self.__config_name=config_name self.itemDataMap={} # main boxsizer main_bs=wx.BoxSizer(wx.VERTICAL) # add custom controls here self.getcontrols(main_bs) # create a data preview list with supplied column labels self.__list=wx.ListView(self, wx.NewId()) self.__image_list=wx.ImageList(16, 16) self.__ig_up=self.__image_list.Add(wx.ArtProvider_GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (16, 16))) self.__ig_dn=self.__image_list.Add(wx.ArtProvider_GetBitmap(wx.ART_GO_DOWN, wx.ART_OTHER, (16, 16))) self.__list.SetImageList(self.__image_list, wx.IMAGE_LIST_SMALL) li=wx.ListItem() li.m_mask=wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE li.m_image=-1 for i, d in enumerate(self.__col_labels): # insert a column with specified name and width li.m_text=d[1] self.__list.InsertColumnInfo(i, li) self.__list.SetColumnWidth(i, d[2]) main_bs.Add(self.__list, 1, wx.EXPAND, 0) self.populate(data) # the Mixin sorter listmix.ColumnSorterMixin.__init__(self, len(col_labels)) # now the buttons self.getpostcontrols(main_bs) # handle events # all done self.SetSizer(main_bs) self.SetAutoLayout(True) main_bs.Fit(self) # save my own size, if specified if config_name is not None: guiwidgets.set_size(config_name, self) wx.EVT_SIZE(self, self.__save_size)
def __init__(self): wx.Frame.__init__(self, None, title = 'Project Manager', size = (1000, 600)) self.ProjectList = wx.ListView( self, style = wx.LC_SINGLE_SEL|wx.LC_EDIT_LABELS|wx.LC_REPORT|wx.LC_NO_HEADER ) self.Changelog = wx.richtext.RichTextCtrl(self, style = wx.VSCROLL|wx.HSCROLL|wx.NO_BORDER) self.Stripes = wx.Window( self, style = wx.SUNKEN_BORDER ) self.ProjectList.Bind( wx.EVT_LIST_END_LABEL_EDIT, self.OnProjectRename ) self.ProjectList.Bind( wx.EVT_LIST_ITEM_SELECTED, self.OnProjectSelected ) self.SetToolBar(Panels.Toolbar(self)) self.SetMenuBar(Panels.Menu(self)) self.ProjectList.InsertColumn(0, '', width = 200) self.UpdateProjects() self.Bind(wx.EVT_SIZE, self.OnSize) self.OnSize(None)
def _create(self, passthrough): self.account_manager_backend = account_manager.AccountManager() self.selected_account = None # if passthrough is true, check if we only have one account authorizated. If we do, and passthrough is set to true, just pass control to the main ui. if passthrough: if self.account_manager_backend.amount() == 1: self.selected_account = self.account_manager_backend.get_usernames( )[0] self.Close() # trigger the main ui to open return self.panel = wx.Panel(self, size=(400, 650)) self.account_list = wx.ListView(parent=self.panel, style=wx.LC_LIST) self._populate_account_list() self.auth_button = wx.Button(parent=self.panel, label="Authorize new account") AsyncBind(wx.EVT_BUTTON, self.on_auth_new_account_request, self.auth_button) self.delete_button = wx.Button(parent=self.panel, label="Delete") AsyncBind(wx.EVT_BUTTON, self.on_delete_account_request, self.delete_button) self.done_button = wx.Button(parent=self.panel, label="Close") self.done_button.Bind(wx.EVT_BUTTON, self.on_done) self.account_list.Bind( wx.EVT_LIST_ITEM_SELECTED, lambda event: self.done_button.SetLabel("Enter")) self.account_list.Bind( wx.EVT_LIST_ITEM_DESELECTED, lambda event: self.done_button.SetLabel("Close")) self.Centre() mainsizer = wx.BoxSizer(wx.VERTICAL) listsizer = wx.BoxSizer() buttonsizer = wx.BoxSizer() listsizer.Add(self.account_list, 0, wx.EXPAND) buttonsizer.Add(self.auth_button, 0) buttonsizer.Add(self.delete_button, 0) buttonsizer.Add(self.done_button, 0) mainsizer.Add(listsizer, 1) mainsizer.Add(buttonsizer, 0) mainsizer.Fit(self) self.Show()
def _init_ctrls(self, prnt): wx.Frame.__init__(self, id=wxID_DEBUG, name='debug', parent=prnt, pos=wx.Point(428, 335), size=wx.Size(705, 207), style=wx.DEFAULT_FRAME_STYLE, title='Debug') self.Centre() self.SetClientSize(wx.Size(689, 171)) self.Bind(wx.EVT_CLOSE, self.OnClose) self.debug_list = wx.ListView(id=wxID_DEBUGDEBUG_LIST, name='debug_list', parent=self, pos=wx.Point(0, 0), size=wx.Size(689, 171), style=wx.LC_SINGLE_SEL | wx.LC_REPORT | wx.LC_SORT_ASCENDING) self._init_coll_debugList_Columns(self.debug_list) self.debug_list.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnDebugListItemSelected, id=wxID_DEBUGDEBUG_LIST)
def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__( self, id=wxID_RESOURCEMODULEFRM, name='ResourceModuleFrm', parent=prnt, pos=wx.Point(604, 403), size=wx.Size(419, 260), style=wx.DEFAULT_FRAME_STYLE, title='Images using a Resource Module built with img2py') self._init_utils() self.SetClientSize(wx.Size(411, 233)) self.SetBackgroundColour(wx.Colour(0, 128, 255)) self.SetSizeHints(419, 260, 419, 260) self.Center(wx.BOTH) self.bitmapButton = wx.BitmapButton( bitmap=Boa_img.getBoaButtonBitmap(), id=wxID_RESOURCEMODULEFRMBITMAPBUTTON, name='bitmapButton', parent=self, pos=wx.Point(16, 67), size=wx.Size(112, 88), style=wx.BU_AUTODRAW) self.bitmapButton.Bind(wx.EVT_BUTTON, self.OnBitmapbuttonButton, id=wxID_RESOURCEMODULEFRMBITMAPBUTTON) self.listView = wx.ListView(id=wxID_RESOURCEMODULEFRMLISTVIEW, name='listView', parent=self, pos=wx.Point(148, 27), size=wx.Size(247, 176), style=wx.LC_SINGLE_SEL | wx.LC_ICON) self.listView.SetImageList(self.images, wx.IMAGE_LIST_NORMAL) self.listView.SetBackgroundColour(wx.Colour(255, 255, 242)) self.listView.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnListviewListItemActivated, id=wxID_RESOURCEMODULEFRMLISTVIEW)
def __init__(self, parent): self.frameParent = None self.associationData = {} self.instruments = {} self.parent = parent wx.Panel.__init__(self, parent) # listView initialization self.listView = wx.ListView(self, -1, style=wx.LC_LIST | wx.LC_SINGLE_SEL) s = wx.BoxSizer(wx.VERTICAL) s.Add(self.listView, 1, wx.EXPAND) self.SetSizer(s) self.listView.Bind(wx.EVT_LIST_BEGIN_DRAG, self.OnDragInit) self.listView.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnActivated) self.generateList(size=(20, 20)) self.listView.Bind(wx.EVT_CONTEXT_MENU, self.showPopupMenu) self.listView.SetAutoLayout(True) self.create_menu()
def _init_ctrls(self, parent): wx.Frame.__init__(self, name='MovieOrganizer', parent=parent, style=wx.DEFAULT_FRAME_STYLE, title='Movie Organizer') self.SetClientSize(wx.Size(640, 480)) self.Bind(wx.EVT_CLOSE, self.OnClose) self._init_menus() self.statusBar = self.CreateStatusBar() #the main splitter window self.splitBase = wx.SplitterWindow(self, style=wx.SP_NOBORDER) #Create the treectrl for the filters self.filterPanel = wx.Panel(self.splitBase) self.movieFilter = wx.TreeCtrl(self.filterPanel, style=wx.TR_DEFAULT_STYLE | wx.SUNKEN_BORDER) self._init_filter() self.movieFilter.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnMovieFilterSelChanged) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(self.movieFilter, 1, wx.EXPAND | wx.ALL, 1) self.filterPanel.SetSizer(vbox) self.filterPanel.Layout() #the right hand window of the main splitter self.splitRight = wx.SplitterWindow(self.splitBase, style=wx.SP_NOBORDER) self.splitBase.SplitVertically(self.filterPanel, self.splitRight) self.splitBase.SetSashPosition(160) #panel to hold the movielist and its toolbar self.movieListPanel = wx.Panel(self.splitRight) self.searchBox = wx.SearchCtrl(self.movieListPanel, size=(200, -1), style=wx.TE_PROCESS_ENTER) self.searchBox.ShowSearchButton(False) self.Bind(wx.EVT_TEXT, self.OnMovieListTbSearch, self.searchBox) #the list of movies self.movieList = wx.ListView(self.movieListPanel, size=wx.Size(210, -1), style=wx.LC_REPORT | wx.SUNKEN_BORDER) self.movieList.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnMovieListSelected) self.movieList.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.OnMovieListRightClick) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(self.searchBox, 0, wx.ALL | wx.EXPAND, 1) vbox.Add(self.movieList, 1, wx.EXPAND | wx.ALL, 1) self.movieListPanel.SetSizer(vbox) self.movieListPanel.Layout() #panel to display movie details self.movieDetail = wx.Panel(self.splitRight) self.movieDetailTb = self._create_movie_detail_tb(self.movieDetail) #htmlwindow showing movie details self.movieDetailHtml = wx.html.HtmlWindow(self.movieDetail, style=wx.SUNKEN_BORDER) #the player window self.player = wx.Panel(self.movieDetail) self.videopanel = wx.Panel(self.player) self.videopanel.SetBackgroundColour(wx.BLACK) self.playerctrlpanel = wx.Panel(self.player, -1) self.timeslider = wx.Slider(self.playerctrlpanel, -1, 0, 0, 1000) self.timeslider.SetRange(0, 1000) self.btnPlay = wx.Button(self.playerctrlpanel, label="Play") self.btnStop = wx.Button(self.playerctrlpanel, label="Stop") self.btnFullscreen = wx.Button(self.playerctrlpanel, label="Fullscreen") self.btnVolume = wx.Button(self.playerctrlpanel, label="Mute") self.volslider = wx.Slider(self.playerctrlpanel, -1, 0, 0, 100, size=(100, -1)) self.playerTimer = wx.Timer(self) #event bindings self.Bind(wx.EVT_BUTTON, self.OnPlayerPlay, self.btnPlay) self.Bind(wx.EVT_BUTTON, self.OnPlayerStop, self.btnStop) self.Bind(wx.EVT_BUTTON, self.OnPlayerToggleVolume, self.btnVolume) self.Bind(wx.EVT_BUTTON, self.OnPlayerFullScreen, self.btnFullscreen) self.Bind(wx.EVT_SLIDER, self.OnPlayerSetVolume, self.volslider) self.Bind(wx.EVT_SLIDER, self.OnPlayerSetTime, self.timeslider) self.Bind(wx.EVT_KEY_UP, self.onKeyPress) self.Bind(wx.EVT_TIMER, self.OnPlayerTimer, self.playerTimer) box1 = wx.BoxSizer(wx.HORIZONTAL) box2 = wx.BoxSizer(wx.HORIZONTAL) ctrlbox = wx.BoxSizer(wx.VERTICAL) box1.Add(self.timeslider, 1) box2.Add(self.btnPlay, flag=wx.RIGHT, border=5) #box2.Add(self.btnPause) box2.Add(self.btnStop, flag=wx.RIGHT, border=5) box2.Add(self.btnFullscreen, flag=wx.RIGHT, border=5) box2.Add((-1, -1), 1) box2.Add(self.btnVolume) box2.Add(self.volslider, flag=wx.TOP | wx.LEFT, border=5) ctrlbox.Add(box1, flag=wx.EXPAND | wx.BOTTOM, border=10) ctrlbox.Add(box2, 1, wx.EXPAND) self.playerctrlpanel.SetSizer(ctrlbox) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(self.videopanel, 1, wx.EXPAND | wx.ALL, 1) vbox.Add(self.playerctrlpanel, 0, wx.EXPAND | wx.ALL, 0) self.player.SetSizer(vbox) self.player.Show(False) #finish off the layouts vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(self.movieDetailTb, 0, wx.ALL | wx.ALIGN_LEFT | wx.EXPAND, 0) vbox.Add(self.movieDetailHtml, 1, wx.EXPAND | wx.ALL, 0) vbox.Add(self.player, 1, wx.EXPAND | wx.ALL, 0) self.movieDetail.SetSizer(vbox) self.movieDetail.Layout() self.splitRight.SplitVertically(self.movieListPanel, self.movieDetail) self.splitRight.SetSashPosition(210) #do other inits self._init_vlc() self._init_movielist() self._display_details()
def __init__(self, parent, reddit_instance): super().__init__(parent, reddit_instance) self.subreddit_list = wx.ListView(self) self.subreddit_list.AppendColumn("Subreddits")
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.submission_list = wx.ListView(self) self.submission_list.AppendColumn("HOME")
def _create_controls(self): self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) self.m_mgr = wx.aui.AuiManager() self.m_mgr.SetManagedWindow(self) self.m_mgr.SetFlags(wx.aui.AUI_MGR_DEFAULT) self.m_panel_node = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) self.m_mgr.AddPane( self.m_panel_node, wx.aui.AuiPaneInfo().Left().Caption( u"Nodes").CloseButton(False).Dock().Resizable().FloatingSize( wx.Size(200, 36)).Row(1).MinSize(wx.Size(200, 200)).Layer(0)) bSizer2 = wx.BoxSizer(wx.VERTICAL) self.m_search_node_ctrl = wx.SearchCtrl(self.m_panel_node, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) self.m_search_node_ctrl.ShowSearchButton(True) self.m_search_node_ctrl.ShowCancelButton(True) bSizer2.Add(self.m_search_node_ctrl, 0, wx.ALL | wx.EXPAND, 5) self.m_list_node_ctrl = wx.ListView(self.m_panel_node, wx.ID_ANY, wx.DefaultPosition, wx.Size(250, -1), wx.LC_REPORT) self.m_list_node_ctrl.InsertColumn(0, "No.", width=50) self.m_list_node_ctrl.InsertColumn(1, "Name", width=150) bSizer2.Add(self.m_list_node_ctrl, 1, wx.EXPAND, 5) self.m_panel_node.SetSizer(bSizer2) self.m_panel_node.Layout() bSizer2.Fit(self.m_panel_node) self.m_panel_main = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) self.m_mgr.AddPane( self.m_panel_main, wx.aui.AuiPaneInfo().Center().CaptionVisible(False).CloseButton( False).PaneBorder(False).Movable(False).Dock().Resizable(). FloatingSize(wx.DefaultSize).DockFixed(True).BottomDockable( False).TopDockable(False).LeftDockable(False).RightDockable( False).Floatable(False).CentrePane()) bSizer3 = wx.BoxSizer(wx.VERTICAL) self.m_html_win = wx.html.HtmlWindow(self.m_panel_main, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.html.HW_SCROLLBAR_AUTO) bSizer3.Add(self.m_html_win, 1, wx.EXPAND, 5) # self.m_html_win = pdfViewer( # self.m_panel_main, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, # wx.HSCROLL | wx.VSCROLL) # self.m_html_win.UsePrintDirect = False # self.m_SetSizerProps(expand=True, proportion=1) # wx.html.HtmlWindow(self.m_panel_main, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.html.HW_SCROLLBAR_AUTO) self.m_panel_main.SetSizer(bSizer3) self.m_panel_main.Layout() bSizer3.Fit(self.m_panel_main) self.m_panel_link = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) self.m_mgr.AddPane( self.m_panel_link, wx.aui.AuiPaneInfo().Right().Caption(u"Links").CloseButton( False).Dock().Resizable().FloatingSize(wx.Size( 400, 250)).Row(1).Position(1).MinSize(wx.Size(200, 250))) bSizer4 = wx.BoxSizer(wx.VERTICAL) self.m_search_link_ctrl = wx.SearchCtrl(self.m_panel_link, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) self.m_search_link_ctrl.ShowSearchButton(True) self.m_search_link_ctrl.ShowCancelButton(True) bSizer4.Add(self.m_search_link_ctrl, 0, wx.ALL | wx.EXPAND, 5) self.m_list_link_ctrl = wx.ListCtrl(self.m_panel_link, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LC_REPORT) self.m_list_link_ctrl.InsertColumn(0, "From", width=100) self.m_list_link_ctrl.InsertColumn(1, "To", width=100) bSizer4.Add(self.m_list_link_ctrl, 1, wx.EXPAND, 5) self.m_panel_link.SetSizer(bSizer4) self.m_panel_link.Layout() bSizer4.Fit(self.m_panel_link) # create the menubar / toolbar / statusbar self._create_menubar() self._create_toolbar() self.m_statusBar = self.CreateStatusBar(1, wx.STB_SIZEGRIP, wx.ID_ANY) self.m_mgr.Update() self.Centre(wx.BOTH)
def __init__(self, parent, title, choices, sort=True, point=wx.DefaultPosition, size=(250, 300), SetSizer=True, header="", editbutton=""): wx.Dialog.__init__( self, parent, -1, title, point, size, wx.DEFAULT_DIALOG_STYLE | wx.MAXIMIZE_BOX | wx.THICK_FRAME | wx.RESIZE_BORDER) self.parent = parent self.ID_CHOICES = 101 self.ID_TXT_STATIC = 102 self.ID_TXT_CHOICE = 103 self.ID_OK = 111 self.ID_CANCEL = 112 if editbutton: self.ID_EDIT = 113 #/Constants #Components: self.listChoices = wx.ListView(self, self.ID_CHOICES, (0, 0), (300, 300), style=wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.LC_NO_HEADER) if header: self.txtHeader = wx.StaticText(self, self.ID_TXT_STATIC, header, (0, 0), (300, -1)) self.txtChoice = wx.TextCtrl(self, self.ID_TXT_CHOICE, '', (0, 0), (250, -1), style=wx.TE_READONLY) self.choices = choices self.listChoices.InsertColumn(0, 'Choices') if sort: self.choices.sort() #self.choices.sort(lambda x,y: cmp(x.lower(), y.lower())) #case insensitve self.setupchoices() self.OnSize(None) self.btnOk = wx.Button(self, self.ID_OK, " &Ok ") #self.btnOk.SetDefault() self.btnCancel = wx.Button(self, self.ID_CANCEL, " &Cancel ") if editbutton: self.btnEdit = wx.Button(self, self.ID_EDIT, editbutton) #/Components #Sizer: self.theSizer = wx.BoxSizer(wx.VERTICAL) self.textSizer = wx.BoxSizer(wx.HORIZONTAL) self.textSizer.Add(wx.StaticText(self, -1, ' '), 0, wx.SHAPED | wx.ALIGN_RIGHT) self.textSizer.Add(self.txtChoice, 1, wx.EXPAND) self.textSizer.Add(wx.StaticText(self, -1, ' '), 0, wx.SHAPED) if header: self.headerSizer = wx.BoxSizer(wx.HORIZONTAL) self.headerSizer.Add(wx.StaticText(self, -1, ' '), 0, wx.SHAPED | wx.ALIGN_RIGHT) self.headerSizer.Add(self.txtHeader, 1, wx.EXPAND) self.headerSizer.Add(wx.StaticText(self, -1, ' '), 0, wx.SHAPED) self.listSizer = wx.BoxSizer(wx.HORIZONTAL) self.listSizer.Add(wx.StaticText(self, -1, ' '), 0, wx.SHAPED | wx.ALIGN_RIGHT) self.listSizer.Add(self.listChoices, 1, wx.EXPAND) self.listSizer.Add(wx.StaticText(self, -1, ' '), 0, wx.SHAPED) self.commandSizer = wx.BoxSizer(wx.HORIZONTAL) self.commandSizer.Add(wx.StaticText(self, -1, ' '), 0, wx.SHAPED | wx.ALIGN_RIGHT) self.commandSizer.Add(self.btnCancel, 0, wx.SHAPED | wx.ALIGN_LEFT) if editbutton: self.commandSizer.Add(wx.StaticText(self, -1, ' '), 1, wx.SHAPED | wx.ALIGN_RIGHT) self.commandSizer.Add(self.btnEdit, 0, wx.SHAPED | wx.ALIGN_LEFT) self.commandSizer.Add(wx.StaticText(self, -1, ' '), 1, wx.EXPAND) self.commandSizer.Add(self.btnOk, 0, wx.SHAPED | wx.ALIGN_RIGHT) self.commandSizer.Add(wx.StaticText(self, -1, ' '), 0, wx.SHAPED | wx.ALIGN_RIGHT) self.theSizer.Add(wx.StaticText(self, -1, ' '), 0, wx.SHAPED) if header: self.theSizer.Add(self.headerSizer, 0, wx.EXPAND) self.theSizer.Add(wx.StaticText(self, -1, ' '), 0, wx.SHAPED) self.theSizer.Add(self.textSizer, 0, wx.EXPAND) self.theSizer.Add(wx.StaticText(self, -1, ' '), 0, wx.SHAPED) self.theSizer.Add(self.listSizer, 9, wx.EXPAND) self.theSizer.Add(wx.StaticText(self, -1, ' '), 0, wx.SHAPED) self.theSizer.Add(self.commandSizer, 0, wx.EXPAND) self.theSizer.Add(wx.StaticText(self, -1, ' '), 0, wx.SHAPED) self.SetAutoLayout(True) if SetSizer: self.SetSizerAndFit(self.theSizer) #/Sizer #Events: self.Bind(wx.EVT_BUTTON, self.OnbtnCancel, id=self.ID_CANCEL) self.Bind(wx.EVT_BUTTON, self.OnbtnOk, id=self.ID_OK) if editbutton: self.Bind(wx.EVT_BUTTON, self.OnbtnEdit, id=self.ID_EDIT) self.listChoices.Bind(wx.EVT_LEFT_DCLICK, self.OnbtnOk) self.txtChoice.Bind(wx.EVT_CHAR, self.OnChar) if wx.Platform == '__WXGTK__': self.txtChoice.SetFocus() else: self.Bind(wx.EVT_CHAR, self.OnChar) self.listChoices.Bind(wx.EVT_CHAR, self.OnChar) self.listChoices.Bind(wx.EVT_SIZE, self.OnSize) #/Events if self.listChoices.GetItemCount() > 0: self.listChoices.Select(0) self.listChoices.Focus(0) self.typedchoice = ''
def __init__(self, *args, **kwds): # begin wxGlade: MainLibFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) # tell wx about our hard coded IDs so wx.NewId() doesn't collide # with them for i in range(ID_MINNUM, ID_MAXNUM): wx.RegisterId(i) # set up list control self.list = wx.ListView(self, -1, style=wx.LC_REPORT | wx.SUNKEN_BORDER) self.list.InsertColumn(0, "Artist", width=150) self.list.InsertColumn(1, "Album", width=350) self.list.InsertColumn(2, "Date", width=100) wx.EVT_LIST_COL_CLICK(self, -1, self.OnListSort) wx.EVT_LIST_ITEM_RIGHT_CLICK(self, -1, self.OnListClick) wx.EVT_LIST_ITEM_ACTIVATED(self, -1, self.OnListDoubleClick) wx.EVT_LIST_ITEM_FOCUSED(self, -1, self.OnListSelect) # set up controls in properties panel self.bmpCoverArt = wx.StaticBitmap(self, -1) self.lblArtist = wx.StaticText(self, -1, "Welcome to Flacenstein") self.lblAlbum = wx.StaticText(self, -1, "Right click to select library items") self.ggeProgress = wx.Gauge(self, -1, 1) # Menu Bar self.library_menubar = wx.MenuBar() self.SetMenuBar(self.library_menubar) wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(ID_OPEN, "Load Library\tCTRL-O", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(ID_SAVE, "Save Library\tCTRL-S", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(ID_EXPORT, "Export List", "", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(ID_SETPATH, "Configure Paths", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(ID_RESCAN, "Rescan\tF5", "", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(ID_RIP, "Rip...", "", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(wx.ID_EXIT, "Quit\tCTRL-Q", "", wx.ITEM_NORMAL) self.library_menubar.Append(wxglade_tmp_menu, "Library") wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(ID_LOADSELECT, "Load Selection\tCTRL-G", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(ID_SAVESELECT, "Save Selection\tCTRL-D", "", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(ID_SELECTALL, "All\tCTRL-A", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(ID_SELECTNONE, "None", "", wx.ITEM_NORMAL) self.library_menubar.Append(wxglade_tmp_menu, "Select") tmp_menu = wx.Menu() tmp_menu.Append(ID_CONFIGURE, "Configure", "", wx.ITEM_NORMAL) # mnuStop has to be explicitly created so that we can call .Enable() self.mnuStop = wx.MenuItem(tmp_menu, ID_STOP, "Stop", "", wx.ITEM_NORMAL) tmp_menu.AppendItem(self.mnuStop) tmp_menu.AppendSeparator() self.transforms = {} for xfm in flaccfg.XFM_MODS: global xfmmod xfmmod = __import__('flacenstein.xfm%s' % xfm, globals(), locals(), 'xfm%s' % xfm) i = wx.NewId() self.transforms[i] = xfm tmp_menu.Append(i, xfmmod.description, "", wx.ITEM_NORMAL) works = xfmmod.ready() tmp_menu.Enable(i, works) if not works: print '"%s" module failed self-tests and is disabled.' % \ xfmmod.description wx.EVT_MENU(self, i, self.OnTransform) del xfmmod self.library_menubar.Append(tmp_menu, "Transform") wx.EVT_MENU(self, ID_OPEN, self.OnOpen) wx.EVT_MENU(self, ID_SAVE, self.OnSave) wx.EVT_MENU(self, ID_EXPORT, self.OnExport) wx.EVT_MENU(self, ID_SETPATH, self.OnSetPath) wx.EVT_MENU(self, ID_RESCAN, self.OnRescan) wx.EVT_MENU(self, wx.ID_EXIT, self.OnQuit) wx.EVT_MENU(self, ID_SELECTALL, self.OnSelectAll) wx.EVT_MENU(self, ID_SELECTNONE, self.OnSelectNone) wx.EVT_MENU(self, ID_LOADSELECT, self.OnLoadSelection) wx.EVT_MENU(self, ID_SAVESELECT, self.OnSaveSelection) wx.EVT_MENU(self, ID_CONFIGURE, self.OnConfigure) wx.EVT_MENU(self, ID_STOP, self.OnStop) wx.EVT_MENU(self, ID_RIP, self.OnRip) # Menu Bar end self.library_statusbar = self.CreateStatusBar(1, 0) self.__set_properties() self.__do_layout() # end wxGlade # horrible kludge to try to work around the fact that on my home # machine, e.RequestMore(True) in an idle handler appears to do # nothing: idle events stop coming in if you don't move the mouse, # etc. self.timer = wx.Timer(self, ID_TIMER) wx.EVT_TIMER(self, ID_TIMER, self.OnIdle) #wx.EVT_IDLE(self, self.OnIdle) self.listdict = {} self.sortfields = ["artist", "date"] self.savefile = "flaclibrary.dat" self.listfile = "flacselection.lst" self.outpath = "/tmp/flac" self.parallelism = flaccfg.DEFAULT_PARALLELISM self.children = {} self.jobs = [] self.workinprogress = False self.mnuStop.Enable(False) self.lib = flaclib.FlacLibrary("/mnt/flac") self.lib.statusnotify = self.statusNotify if os.path.isfile(flaccfg.DEFAULT_LIBRARY): self.loadLibrary(flaccfg.DEFAULT_LIBRARY) else: self.lib.scan() self.displayLibrary() self.setState(STATE_IDLE)
def __init__(self, parent): wx.Panel.__init__(self, parent) self._list = wx.ListView(self) self._list.InsertColumn(0, "Name") self._list.InsertColumn(1, "FnO Type") self._list.InsertColumn(2, "Buy Week") self._list.InsertColumn(3, "Sell Week") self._list.InsertColumn(4, "Price Target") self._log = wx.TextCtrl(self, size=(-1, 200), style=wx.TE_MULTILINE) addBtn = wx.Button(self, label="Add Strategy") addBtn.Bind(wx.EVT_BUTTON, self._onAdd) editBtn = wx.Button(self, label="Edit Strategy") editBtn.Bind(wx.EVT_BUTTON, self._onEdit) delBtn = wx.Button(self, label="Delete Strategy") delBtn.Bind(wx.EVT_BUTTON, self._onDelete) self._dbFile = wx.TextCtrl(self, size=(300, -1)) self._dbFile.Bind(wx.EVT_TEXT, self._updateModelWrapper('dbFile')) dbFileBtn = wx.Button(self, label="...") dbFileBtn.Bind(wx.EVT_BUTTON, self._onDbFileBtn) self._tableName = wx.TextCtrl(self) self._tableName.Bind(wx.EVT_TEXT, self._updateModelWrapper('tableName')) self._startMonth = wx.ComboBox(self, choices=list(calendar.month_abbr)[1:]) self._startMonth.Bind(wx.EVT_COMBOBOX, self._updateModelWrapper('startMonth')) self._startYear = wx.ComboBox(self, choices=map(str, range(2001, 2011))) self._startYear.Bind(wx.EVT_COMBOBOX, self._updateModelWrapper('startYear')) self._endMonth = wx.ComboBox(self, choices=list(calendar.month_abbr)[1:]) self._endMonth.Bind(wx.EVT_COMBOBOX, self._updateModelWrapper('endMonth')) self._endYear = wx.ComboBox(self, choices=map(str, range(2001, 2011))) self._endYear.Bind(wx.EVT_COMBOBOX, self._updateModelWrapper('endYear')) self.analyzeBtn = analyzeBtn = wx.Button(self, label="Start") analyzeBtn.Bind(wx.EVT_BUTTON, self._onAnalyze) border = 4 topSizer = wx.BoxSizer(wx.HORIZONTAL) topSizer.Add(addBtn, border=border, flag=wx.RIGHT) topSizer.Add(editBtn, border=border, flag=wx.RIGHT) topSizer.Add(delBtn) middleSizer = wx.BoxSizer(wx.HORIZONTAL) middleSizer.Add(wx.StaticText(self, label="DB File:"), border=border, flag=wx.RIGHT) middleSizer.Add(self._dbFile, border=border, flag=wx.RIGHT) middleSizer.Add(dbFileBtn, border=border, flag=wx.RIGHT) middleSizer.Add(wx.StaticText(self, label="symbol:"), border=border, flag=wx.RIGHT) middleSizer.Add(self._tableName, border=border) bottomSizer = wx.BoxSizer(wx.HORIZONTAL) bottomSizer.Add(wx.StaticText(self, label="Analyze From "), border=border, flag=wx.RIGHT) bottomSizer.Add(self._startMonth, border=border, flag=wx.RIGHT) bottomSizer.Add(self._startYear, border=border, flag=wx.RIGHT) bottomSizer.Add(wx.StaticText(self, label=" to "), border=border, flag=wx.RIGHT) bottomSizer.Add(self._endMonth, border=border, flag=wx.RIGHT) bottomSizer.Add(self._endYear, border=border, flag=wx.RIGHT) bottomSizer.Add(analyzeBtn) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add( topSizer, border=border, flag=wx.ALL | wx.EXPAND, ) sizer.Add(self._list, proportion=1, flag=wx.ALL | wx.EXPAND, border=border) sizer.Add( middleSizer, border=border, flag=wx.ALL | wx.EXPAND, ) sizer.Add( bottomSizer, border=border, flag=wx.ALL | wx.EXPAND, ) sizer.Add( self._log, border=border, flag=wx.ALL | wx.EXPAND, ) self.SetSizer(sizer) self.model = None self._analysis_thread = None self._lastLogs = []
def _init_ctrls(self, prnt): # generated method, don't edit wx.Frame.__init__(self, id=wxID_MAINFRAME, name=u'MainFrame', parent=prnt, pos=wx.Point(551, 244), size=wx.Size(644, 446), style=wx.DEFAULT_FRAME_STYLE, title=u'DAB+ Receiver') self._init_utils() self.SetClientSize(wx.Size(636, 412)) self.SetMenuBar(self.mainMenuBar) self.SetIcon(wx.Icon(u'Boa.ico', wx.BITMAP_TYPE_ICO)) self.mainStatusBar = wx.StatusBar(id=wxID_MAINFRAMEMAINSTATUSBAR, name=u'mainStatusBar', parent=self, style=0) self._init_coll_mainStatusBar_Fields(self.mainStatusBar) self.SetStatusBar(self.mainStatusBar) self.mainPanel = wx.Panel(id=wxID_MAINFRAMEMAINPANEL, name=u'mainPanel', parent=self, pos=wx.Point(0, 0), size=wx.Size(636, 370), style=wx.TAB_TRAVERSAL) self.progListView = wx.ListView(id=wxID_MAINFRAMEPROGLISTVIEW, name=u'progListView', parent=self.mainPanel, pos=wx.Point(358, 0), size=wx.Size(322, 370), style=wx.LC_REPORT) self.progListView.SetLabel(u'Program List') self._init_coll_progListView_Columns(self.progListView) self.stMode = wx.StaticText(id=wxID_MAINFRAMESTMODE, label=u'DAB Mode', name=u'stMode', parent=self.mainPanel, pos=wx.Point(2, 2), size=wx.Size(70, 21), style=0) self.stFreq = wx.StaticText(id=wxID_MAINFRAMESTFREQ, label=u'Frequency', name=u'stFreq', parent=self.mainPanel, pos=wx.Point(2, 27), size=wx.Size(70, 21), style=0) self.stGain = wx.StaticText(id=wxID_MAINFRAMESTGAIN, label=u'USRP Gain', name=u'stGain', parent=self.mainPanel, pos=wx.Point(2, 52), size=wx.Size(70, 21), style=0) self.stConfig = wx.StaticText(id=wxID_MAINFRAMESTCONFIG, label=u'Configuration', name=u'stConfig', parent=self.mainPanel, pos=wx.Point(2, 77), size=wx.Size(70, 21), style=0) self.mode = wx.TextCtrl(id=wxID_MAINFRAMEMODE, name=u'mode', parent=self.mainPanel, pos=wx.Point(76, 2), size=wx.Size(247, 21), style=wx.TE_PROCESS_ENTER, value=u'1') self.mode.Bind(wx.EVT_TEXT_ENTER, self.OnModeTextEnter) self.freq = wx.TextCtrl(id=wxID_MAINFRAMEFREQ, name=u'freq', parent=self.mainPanel, pos=wx.Point(76, 27), size=wx.Size(247, 21), style=wx.TE_PROCESS_ENTER, value=u'204.64') self.freq.Bind(wx.EVT_TEXT_ENTER, self.OnFreqTextEnter) self.gain = wx.TextCtrl(id=wxID_MAINFRAMEGAIN, name=u'gain', parent=self.mainPanel, pos=wx.Point(76, 52), size=wx.Size(247, 21), style=wx.TE_PROCESS_ENTER, value=u'8') self.gain.Bind(wx.EVT_TEXT_ENTER, self.OnGainTextEnter) self.config = wx.TextCtrl(id=wxID_MAINFRAMECONFIG, name=u'config', parent=self.mainPanel, pos=wx.Point(76, 77), size=wx.Size(247, 21), style=0, value=u'channel.conf') self.config.SetEditable(False) self.buttonScan = wx.Button(id=wxID_MAINFRAMEBUTTONSCAN, label=u'Scan', name=u'buttonScan', parent=self.mainPanel, pos=wx.Point(0, 158), size=wx.Size(75, 23), style=0) self.buttonScan.Bind(wx.EVT_BUTTON, self.OnButtonScanButton) self.buttonRecord = wx.Button(id=wxID_MAINFRAMEBUTTONRECORD, label=u'Record', name=u'buttonRecord', parent=self.mainPanel, pos=wx.Point(75, 158), size=wx.Size(75, 23), style=0) self.buttonRecord.Bind(wx.EVT_BUTTON, self.OnButtonRecordButton) self.buttonPlay = wx.Button(id=wxID_MAINFRAMEBUTTONPLAY, label=u'Play', name=u'buttonPlay', parent=self.mainPanel, pos=wx.Point(0, 181), size=wx.Size(75, 23), style=0) self.buttonPlay.Bind(wx.EVT_BUTTON, self.OnButtonPlayButton) self.buttonStop = wx.Button(id=wx.ID_STOP, label=u'Stop', name=u'buttonStop', parent=self.mainPanel, pos=wx.Point(75, 181), size=wx.Size(75, 23), style=0) self.buttonStop.Bind(wx.EVT_BUTTON, self.OnButtonStopButton) self.stModeTail = wx.StaticText(id=wxID_MAINFRAMESTMODETAIL, label=u'', name=u'stModeTail', parent=self.mainPanel, pos=wx.Point(325, 0), size=wx.Size(25, 25), style=0) self.stFreqUnit = wx.StaticText(id=wxID_MAINFRAMESTFREQUNIT, label=u'MHz', name=u'stFreqUnit', parent=self.mainPanel, pos=wx.Point(325, 25), size=wx.Size(25, 25), style=0) self.stGainUnit = wx.StaticText(id=wxID_MAINFRAMESTGAINUNIT, label=u'dB', name=u'stGainUnit', parent=self.mainPanel, pos=wx.Point(325, 50), size=wx.Size(25, 25), style=0) self.buttonConfig = wx.Button(id=wxID_MAINFRAMEBUTTONCONFIG, label=u'...', name=u'buttonConfig', parent=self.mainPanel, pos=wx.Point(325, 75), size=wx.Size(20, 23), style=0) self.buttonConfig.Bind(wx.EVT_BUTTON, self.OnMenuFileConfigurationMenu) self.rbUsrp = wx.RadioButton(id=wxID_MAINFRAMERBUSRP, label=u'USRP', name=u'rbUsrp', parent=self.mainPanel, pos=wx.Point(2, 127), size=wx.Size(65, 21), style=wx.RB_GROUP) self.rbUsrp.SetValue(True) self.rbUsrp.Bind(wx.EVT_RADIOBUTTON, self.OnRbUsrpRadiobutton) self.rbSample = wx.RadioButton(id=wxID_MAINFRAMERBSAMPLE, label=u'Sample', name=u'rbSample', parent=self.mainPanel, pos=wx.Point(76, 127), size=wx.Size(106, 21), style=0) self.rbSample.SetValue(False) self.rbSample.Bind(wx.EVT_RADIOBUTTON, self.OnRbSampleRadiobutton) self.stSample = wx.StaticText(id=wxID_MAINFRAMESTSAMPLE, label=u'Sample', name=u'stSample', parent=self.mainPanel, pos=wx.Point(2, 102), size=wx.Size(70, 21), style=0) self.sample = wx.TextCtrl(id=wxID_MAINFRAMESAMPLE, name=u'sample', parent=self.mainPanel, pos=wx.Point(76, 102), size=wx.Size(247, 21), style=0, value=u'sample.dat') self.sample.SetEditable(False) self.sample.Enable(False) self.buttonSample = wx.Button(id=wxID_MAINFRAMEBUTTONSAMPLE, label=u'...', name=u'buttonSample', parent=self.mainPanel, pos=wx.Point(325, 100), size=wx.Size(20, 23), style=0) self.buttonSample.Enable(False) self.buttonSample.Bind(wx.EVT_BUTTON, self.OnButtonSampleButton) self._init_sizers()
def __init__(self, model): """The constructor.""" wx.Frame.__init__(self, None, -1, "SharedPaint", wx.DefaultPosition, wx.Size(800, 600)) # Model instance self.__model = model # List containing the participants' IDs self.__participants = [] # Main sizer workspaceSizer = wx.BoxSizer(wx.HORIZONTAL) self.SetSizer(workspaceSizer) # Center panel centerPanel = wx.Panel(self, -1, style=wx.SIMPLE_BORDER) centerPanel.SetBackgroundColour("#BBBBBB") sizer = wx.BoxSizer(wx.VERTICAL) centerPanel.SetSizer(sizer) self.doodle = DoodleWindow(centerPanel, self.__model) sizer.Add(self.doodle, 1, wx.EXPAND | wx.ALL, 1) workspaceSizer.Add(centerPanel, 1, wx.EXPAND | wx.ALL, 1) # Imagelist containing penColor images il = wx.ImageList(24, 24, True) pen = wx.Bitmap("pen.png", wx.BITMAP_TYPE_PNG).ConvertToImage() for color in menuColors: r = int(color[1:3], 16) g = int(color[3:5], 16) b = int(color[5:7], 16) penImage = pen.Copy() penImage.Replace(204, 0, 204, r, g, b) il.Add(penImage.ConvertToBitmap()) # Right panel rightPanel = wx.Panel(self, -1, size=(200, 0)) rightPanelSizer = wx.BoxSizer(wx.VERTICAL) rightPanel.SetSizer(rightPanelSizer) # List of participants staticBox = wx.StaticBox(rightPanel, -1, "Participants") sizer = wx.StaticBoxSizer(staticBox, wx.VERTICAL) self.__list = wx.ListView(rightPanel, -1, size=(200, 0), style=wx.LC_SMALL_ICON) self.__list.SetBackgroundColour(wx.WHITE) self.__list.AssignImageList(il, wx.IMAGE_LIST_SMALL) sizer.Add(self.__list, 1, wx.EXPAND | wx.ALL, 1) rightPanelSizer.Add(sizer, 1, wx.EXPAND | wx.ALL, 1) # Control panel staticBox = wx.StaticBox(rightPanel, -1, "Pen settings") sizer = wx.StaticBoxSizer(staticBox, wx.VERTICAL) self.ctrlPanel = ControlPanel(rightPanel, self.__model.PenColor, self.__model.PenThickness) sizer.Add(self.ctrlPanel, 1, wx.EXPAND | wx.ALL, 1) rightPanelSizer.Add(sizer, 1, wx.EXPAND | wx.ALL, 1) workspaceSizer.Add(rightPanel, 0, wx.EXPAND | wx.ALL, 1) # Application icon self.SetIcon(icons.getAGIconIcon()) # Menu menuBar = wx.MenuBar() session = wx.Menu() #session.Append(101, "&Join", "Join to the SharedPaint drawing session") session.Append(102, "&Take snapshot", "Save the current session status: snapshot") session.Append(103, "&Load snapshot...", "Load a saved snapshot") session.Append(104, "&Quit", "Quit the application") menuBar.Append(session, "&Session") imageMenu = wx.Menu() imageMenu.Append(201, "&Load from server", "Load an image from the Venue Server as background") imageMenu.Append(202, "Clear", "Quit the current background image") menuBar.Append(imageMenu, "&Image") drawing = wx.Menu() drawing.Append(301, "&Clear", "Remove all the annotations") drawing.Append(302, "&Undo", "Remove the last annotation made by the participant") menuBar.Append(drawing, "&Annotations") help = wx.Menu() #help.Append(401, "User Manual", "Open the SharedPaint user manual") help.Append(402, "About", "About SharedPaint") menuBar.Append(help, "&Help") self.SetMenuBar(menuBar) # Status bar self.__statusbar = self.CreateStatusBar() toolbar = self.CreateToolBar() toolbar.SetToolBitmapSize((24, 24)) toolbar.AddLabelTool( 102, "", wx.Bitmap("session_snapshot.gif"), longHelp="Save the current session status: snapshot") toolbar.AddLabelTool(103, "", wx.Bitmap("session_load.gif"), longHelp="Load a saved snapshot") toolbar.AddLabelTool( 201, "", wx.Bitmap("image_load.gif"), longHelp="Load an image from the Venue Server as background") toolbar.AddLabelTool(202, "", wx.Bitmap("image_clear.gif"), longHelp="Quit the current background image") toolbar.AddLabelTool(301, "", wx.Bitmap("annotations_clear.gif"), longHelp="Remove all the annotations") toolbar.Realize()
def _init_ctrls(self, prnt, _availableTemplates): # generated method, don't edit wx.Frame.__init__(self, id=wxID_COMPFRAME, name='CompFrame', parent=prnt, pos=wx.Point(553, 276), size=wx.Size(656, 544), style=wx.DEFAULT_FRAME_STYLE, title=u'OSSIE Component Editor') self._init_utils() self.SetClientSize(wx.Size(856, 544)) self.SetMenuBar(self.menuBar1) # self.Center(wx.BOTH) self.Bind(wx.EVT_CLOSE, self.OnCompFrameClose) self.Bind(wx.EVT_ACTIVATE, self.OnCompFrameActivate) self.statusBarComponent = wx.StatusBar( id=wxID_COMPFRAMESTATUSBARCOMPONENT, name='statusBarComponent', parent=self, style=0) self.SetStatusBar(self.statusBarComponent) self.AddPortBtn = wx.Button(id=wxID_COMPFRAMEADDPORTBTN, label='Add Port', name='AddPortBtn', parent=self, pos=wx.Point(387, 216), size=wx.Size(100, 30), style=0) self.AddPortBtn.Bind(wx.EVT_BUTTON, self.OnAddPortBtnButton, id=wxID_COMPFRAMEADDPORTBTN) self.RemoveBtn = wx.Button(id=wxID_COMPFRAMEREMOVEBTN, label='Remove Port', name='RemoveBtn', parent=self, pos=wx.Point(387, 259), size=wx.Size(100, 30), style=0) self.RemoveBtn.Bind(wx.EVT_BUTTON, self.OnRemoveBtnButton, id=wxID_COMPFRAMEREMOVEBTN) self.addProp = wx.Button(id=wxID_COMPFRAMEADDPROP, label=u'Add Property', name=u'addProp', parent=self, pos=wx.Point(384, 356), size=wx.Size(100, 30), style=0) self.addProp.Enable(True) self.addProp.Bind(wx.EVT_BUTTON, self.OnaddPropButton, id=wxID_COMPFRAMEADDPROP) self.removeProp = wx.Button(id=wxID_COMPFRAMEREMOVEPROP, label=u'Remove Property', name=u'removeProp', parent=self, pos=wx.Point(384, 404), size=wx.Size(140, 32), style=0) self.removeProp.Enable(True) self.removeProp.Bind(wx.EVT_BUTTON, self.OnRemovePropButton, id=wxID_COMPFRAMEREMOVEPROP) self.staticText2 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT2, label='Ports', name='staticText2', parent=self, pos=wx.Point(167, 89), size=wx.Size(65, 17), style=0) self.CloseBtn = wx.Button(id=wxID_COMPFRAMECLOSEBTN, label='Close', name='CloseBtn', parent=self, pos=wx.Point(530, 424), size=wx.Size(85, 32), style=0) self.CloseBtn.Bind(wx.EVT_BUTTON, self.OnCloseBtnButton, id=wxID_COMPFRAMECLOSEBTN) self.TimingcheckBox = wx.CheckBox(id=wxID_COMPFRAMETIMINGCHECKBOX, label=u'Timing Port Support', name=u'TimingcheckBox', parent=self, pos=wx.Point(634, 126), size=wx.Size(185, 21), style=0) self.TimingcheckBox.SetValue(False) self.TimingcheckBox.Bind(wx.EVT_CHECKBOX, self.OnTimingcheckBoxCheckbox, id=wxID_COMPFRAMETIMINGCHECKBOX) self.ACEcheckBox = wx.CheckBox(id=wxID_COMPFRAMEACECHECKBOX, label=u'ACE Support', name=u'ACEcheckBox', parent=self, pos=wx.Point(634, 157), size=wx.Size(125, 21), style=0) self.ACEcheckBox.SetValue(False) self.ACEcheckBox.Bind(wx.EVT_CHECKBOX, self.OnACEcheckBoxCheckbox, id=wxID_COMPFRAMEACECHECKBOX) self.PortBox = wx.TreeCtrl(id=wxID_COMPFRAMEPORTBOX, name=u'PortBox', parent=self, pos=wx.Point(40, 112), size=wx.Size(312, 185), style=wx.SIMPLE_BORDER | wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT) self.PortBox.SetImageList(self.imageListPorts) self.PortBox.SetBestFittingSize(wx.Size(312, 185)) self.PortBox.Bind(wx.EVT_RIGHT_UP, self.OnPortBoxRightUp) self.AssemblyCcheckBox = wx.CheckBox( id=wxID_COMPFRAMEASSEMBLYCCHECKBOX, label=u'Assembly Controller', name=u'AssemblyCcheckBox', parent=self, pos=wx.Point(384, 126), size=wx.Size(165, 21), style=0) self.AssemblyCcheckBox.SetValue(False) self.AssemblyCcheckBox.Bind(wx.EVT_CHECKBOX, self.OnAssemblyCcheckBoxCheckbox, id=wxID_COMPFRAMEASSEMBLYCCHECKBOX) self.compNameBox = wx.TextCtrl(id=wxID_COMPFRAMECOMPNAMEBOX, name=u'compNameBox', parent=self, pos=wx.Point(138, 10), size=wx.Size(215, 25), style=0, value=u'') self.staticText1 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT1, label=u'Component Name:', name='staticText1', parent=self, pos=wx.Point(24, 13), size=wx.Size(110, 17), style=0) self.compDescrBox = wx.TextCtrl(id=wxID_COMPFRAMECOMPDESCRBOX, name=u'compDescrBox', parent=self, pos=wx.Point(110, 40), size=wx.Size(243, 50), style=wx.TE_BESTWRAP | wx.TE_MULTILINE, value=u'') self.staticText1_1 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT8, label=u'Description:', name='staticText8', parent=self, pos=wx.Point(24, 43), size=wx.Size(110, 17), style=0) self.deviceChoice = wx.Choice(choices=[], id=wxID_COMPFRAMEDEVICECHOICE, name=u'deviceChoice', parent=self, pos=wx.Point(453, 93), size=wx.Size(136, 28), style=0) self.deviceChoice.SetBestFittingSize(wx.Size(136, 28)) self.deviceChoice.Bind(wx.EVT_CHOICE, self.OnDeviceChoiceChoice, id=wxID_COMPFRAMEDEVICECHOICE) self.staticText3 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT3, label=u'Waveform Deployment Settings', name='staticText3', parent=self, pos=wx.Point(384, 24), size=wx.Size(100, 35), style=wx.TE_BESTWRAP | wx.TE_MULTILINE) self.staticText3.SetFont( wx.Font(8, wx.SWISS, wx.NORMAL, wx.BOLD, True, u'Sans')) self.nodeChoice = wx.Choice(choices=[], id=wxID_COMPFRAMENODECHOICE, name=u'nodeChoice', parent=self, pos=wx.Point(453, 60), size=wx.Size(136, 28), style=0) self.nodeChoice.Bind(wx.EVT_CHOICE, self.OnNodeChoiceChoice, id=wxID_COMPFRAMENODECHOICE) self.staticText4 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT4, label=u'Node', name='staticText4', parent=self, pos=wx.Point(384, 65), size=wx.Size(41, 17), style=0) self.staticText5 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT5, label=u'Device', name='staticText5', parent=self, pos=wx.Point(384, 98), size=wx.Size(51, 17), style=0) self.staticText6 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT6, label=u'Component Generation Options', name='staticText6', parent=self, pos=wx.Point(634, 24), size=wx.Size(100, 35), style=wx.TE_BESTWRAP | wx.TE_MULTILINE) self.staticText6.SetFont( wx.Font(8, wx.SWISS, wx.NORMAL, wx.BOLD, True, u'Sans')) self.staticText7 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT7, label=u'Template', name='staticText7', parent=self, pos=wx.Point(634, 65), size=wx.Size(222, 17), style=0) self.propList = wx.ListView(id=wxID_COMPFRAMEPROPLIST, name=u'propList', parent=self, pos=wx.Point(40, 320), size=wx.Size(312, 160), style=wx.LC_SINGLE_SEL | wx.VSCROLL | wx.LC_REPORT | wx.LC_VRULES | wx.LC_HRULES | wx.SIMPLE_BORDER) self.propList.SetBestFittingSize(wx.Size(312, 160)) self._init_coll_propList_Columns(self.propList) #self.propList.Bind(wx.EVT_RIGHT_UP, self.OnPropListRightUp) self.propList.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.OnPropListListItemRightClick) self.propList.Bind(wx.EVT_LEFT_DCLICK, self.OnPropListLeftDclick) self.staticLine1 = wx.StaticLine(id=wxID_COMPFRAMESTATICLINE1, name='staticLine1', parent=self, pos=wx.Point(610, 17), size=wx.Size(1, 200), style=wx.LI_VERTICAL) self.templateChoice = wx.Choice(choices=_availableTemplates, id=wxID_COMPFRAMETEMPLATECHOICE, name=u'templateChoice', parent=self, pos=wx.Point(703, 60), size=wx.Size(136, 28), style=0) self.templateChoice.SetBestFittingSize(wx.Size(136, 28)) self.templateChoice.Bind(wx.EVT_CHOICE, self.OnTemplateChoiceChoice, id=wxID_COMPFRAMETEMPLATECHOICE)
def initUi(self): self.ctrls = {} self.volumeboxctrls = {} self.volumeMethodCtrls = {} self.toneboxctrls = {} panel = wx.Panel(self) sizer = wx.BoxSizer(wx.VERTICAL) self.ctrls['listLabel'] = wx.StaticText(panel, label='pliki') self.ctrls['list'] = wx.ListView(panel) self.ctrls['list'].InsertColumn(0, 'nazwa pliku') self.ctrls['list'].InsertColumn(1, 'ścieżka') self.ctrls['listLabel'] = wx.StaticText(panel, label='pliki') self.ctrls['addFile'] = wx.Button(panel, label='dodaj plik') self.ctrls['addFolder'] = wx.Button(panel, label='dodaj folder') self.ctrls['subFolders'] = wx.CheckBox(panel, label='uwzględniaj podfoldery') self.ctrls['fadein'] = wx.CheckBox(panel, label='Łagodny start') self.ctrls['fadeinLabel'] = wx.StaticText(panel, label='Ms') self.ctrls['fadeinValue'] = wx.SpinCtrl(panel, value='0', min=0, max=20000) self.ctrls['fadeout'] = wx.CheckBox(panel, label='Łagodne zciszenie') self.ctrls['fadeoutLabel'] = wx.StaticText(panel, label='Ms') self.ctrls['fadeoutValue'] = wx.SpinCtrl(panel, value='0', min=0, max=20000) self.ctrls['changeVolume'] = wx.CheckBox(panel, label='Zmień głośność') self.volumeboxctrls['volumeChangeGroup'] = wx.StaticBox( panel, -1, "Zmiana głośności") self.ctrls['volumeBoxSizer'] = wx.StaticBoxSizer( self.volumeboxctrls['volumeChangeGroup'], wx.VERTICAL) self.volumeboxctrls['volumeMethodManual'] = wx.RadioButton( panel, -1, " Ręcznie ", style=wx.RB_GROUP) self.volumeboxctrls['volumeMethodAuto'] = wx.RadioButton( panel, -1, " Automatycznie ") self.volumeboxctrls['volumeLabel'] = wx.StaticText(panel, label='DB') self.volumeboxctrls['volumeValue'] = wx.SpinCtrl(panel, value='0', min=-140, max=140) self.ctrls['limiter'] = wx.CheckBox( panel, label='nie dopuszczaj do przesterowania') self.ctrls['swapChannels'] = wx.CheckBox(panel, label='Zamień kanały') self.ctrls['changeTone'] = wx.CheckBox(panel, label='Zmień barwę') self.toneboxctrls['toneChangeGroup'] = wx.StaticBox( panel, -1, "Zmiana barwy") self.ctrls['toneBoxSizer'] = wx.StaticBoxSizer( self.toneboxctrls['toneChangeGroup'], wx.VERTICAL) self.toneboxctrls['toneloLabel'] = wx.StaticText(panel, label='Bas') self.toneboxctrls['toneloValue'] = wx.SpinCtrl(panel, value='0', min=-12, max=12) self.toneboxctrls['tonehiLabel'] = wx.StaticText(panel, label='Góra') self.toneboxctrls['tonehiValue'] = wx.SpinCtrl(panel, value='0', min=-12, max=12) self.ctrls['convert'] = wx.CheckBox(panel, label='Konwertuj') self.formats = ['mp3', 'ogg', 'flac', 'wma', 'aac LC', 'mpc', 'opus'] self.ctrls['convertlistLabel'] = wx.StaticText(panel, label='Konwertuj do') self.ctrls['convertList'] = wx.Choice(panel, choices=self.formats) self.ctrls['start'] = wx.Button(panel, label='Start') self.volumeMethodCtrls['volumeMethodAuto'] = self.volumeboxctrls[ 'volumeMethodAuto'] self.volumeMethodCtrls['volumeMethodManual'] = self.volumeboxctrls[ 'volumeMethodManual'] for ctrl in self.volumeboxctrls.iterkeys(): if ctrl != 'volumeChangeGroup': self.ctrls['volumeBoxSizer'].Add(self.volumeboxctrls[ctrl]) for ctrl in self.toneboxctrls.iterkeys(): if ctrl != 'toneChangeGroup': self.ctrls['toneBoxSizer'].Add(self.toneboxctrls[ctrl]) for ctrl in self.ctrls.itervalues(): sizer.Add(ctrl) for ctrl in self.volumeboxctrls.iterkeys(): self.ctrls[ctrl] = self.volumeboxctrls[ctrl] for ctrl in self.toneboxctrls.iterkeys(): self.ctrls[ctrl] = self.toneboxctrls[ctrl] panel.SetSizerAndFit(sizer)
def __init__(self, parent, filename, id_): self.parent = parent self.filename = filename self.id_ = id_ self.panel = wx.Panel(parent.panel) hbox = wx.BoxSizer(wx.HORIZONTAL) self.panel.SetSizer(hbox) # Do not allow multiple selections, so that it's possible to move rules # up and down # Initialize with a small size so that it will expand properly in the # sizer # The list doesn't seem to support TAB traversal if there's only one # rule (but Home/End and PgUp/PgDown do select it) (bug #336) self.listview = wx.ListView(self.panel, size=(1, 1), style=wx.LC_REPORT | wx.LC_NO_HEADER | wx.LC_SINGLE_SEL) self.listview.InsertColumn(0, 'Rules') hbox.Add(self.listview, 1, flag=wx.EXPAND | wx.RIGHT, border=4) self.rules = [] self.mmode = 'append' pbox = wx.BoxSizer(wx.VERTICAL) self.button_add = wx.Button(self.panel, label='&Add...', style=wx.BU_EXACTFIT) pbox.Add(self.button_add, flag=wx.EXPAND | wx.BOTTOM, border=4) self.button_edit = wx.Button(self.panel, label='&Edit...', style=wx.BU_EXACTFIT) pbox.Add(self.button_edit, flag=wx.EXPAND | wx.BOTTOM, border=4) self.button_up = wx.Button(self.panel, label='Move &up', style=wx.BU_EXACTFIT) pbox.Add(self.button_up, flag=wx.EXPAND | wx.BOTTOM, border=4) self.button_down = wx.Button(self.panel, label='Move &down', style=wx.BU_EXACTFIT) pbox.Add(self.button_down, flag=wx.EXPAND | wx.BOTTOM, border=4) self.button_remove = wx.Button(self.panel, label='&Remove', style=wx.BU_EXACTFIT) pbox.Add(self.button_remove, flag=wx.EXPAND) self.update_buttons() hbox.Add(pbox, flag=wx.EXPAND) self.panel.Bind(wx.EVT_BUTTON, self.add_rule, self.button_add) self.panel.Bind(wx.EVT_BUTTON, self.edit_rule, self.button_edit) self.panel.Bind(wx.EVT_BUTTON, self.remove_rule, self.button_remove) self.panel.Bind(wx.EVT_BUTTON, self.move_rule_up, self.button_up) self.panel.Bind(wx.EVT_BUTTON, self.move_rule_down, self.button_down) self.listview.Bind(wx.EVT_LIST_ITEM_SELECTED, self._update_buttons) self.listview.Bind(wx.EVT_LIST_ITEM_DESELECTED, self._update_buttons) wxgui_api.bind_to_apply_editor(self.handle_apply) wxgui_api.bind_to_check_editor_modified_state( self.handle_check_editor_modified) wxgui_api.bind_to_close_editor(self.handle_close)
def __init__(self, backend, parent, pos=None, size=(400, 400), title="Assets"): if pos == None: parentRect = parent.GetScreenRect() pos = (parentRect.x + parentRect.width, parentRect.y) super().__init__(parent, size, title, pos=pos) self.backend, self.canvasList, self.lastDir = backend((0, 0)), {}, None self.currentIndex, self.leftDown, self.parent, self.scrollFlag = None, False, parent, False self.Bind(wx.EVT_CHAR, self.onChar) self._loadLastDir() self.contextMenu, self.contextMenuItems = wx.Menu(), [] for text, f in ( ("&Load...", self.onLoad), ("Import &ANSI...", self.onImportAnsi), ("Import &SAUCE...", self.onImportSauce), ("Import from &clipboard", self.onImportFromClipboard), ("&Remove", self.onRemove), (None, None), ("Load from l&ist...", self.onLoadList), ("Sa&ve as list...", self.onSaveList), (None, None), ("Cl&ear list", self.onClearList), ): if (text, f) == (None, None): self.contextMenu.AppendSeparator() else: self.contextMenuItems += [ wx.MenuItem(self.contextMenu, wx.NewId(), text) ] self.Bind(wx.EVT_MENU, f, self.contextMenuItems[-1]) self.contextMenu.Append(self.contextMenuItems[-1]) self.listView = wx.ListView( self, -1, size=([int(m / n) for m, n in zip(size, (2, 4))]), style=wx.BORDER_SUNKEN | wx.LC_REPORT) [ self.listView.InsertColumn(col, heading) for col, heading in ((0, "Name"), (1, "Size")) ] self.listView.Bind(wx.EVT_CHAR, self.onListViewChar) self.listView.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onListViewItemSelected) self.listView.Bind(wx.EVT_RIGHT_DOWN, self.onListViewRightDown) self.panelCanvas = GuiWindow(self, (0, 0), wx.BORDER_SUNKEN) self.panelCanvas.Bind(wx.EVT_CHAR, self.onChar) self.panelCanvas.Bind(wx.EVT_LEFT_DOWN, self.onPanelLeftDown) self.panelCanvas.Bind(wx.EVT_PAINT, self.onPanelPaint) self.panelCanvas.Bind(wx.EVT_SIZE, self.onPanelSize) self.sizer = wx.BoxSizer(wx.VERTICAL) self.sizer.AddMany(( (self.listView, 0, wx.ALL | wx.EXPAND, 4), (self.panelCanvas, 1, wx.ALL | wx.EXPAND, 4), )) self.panelCanvas.SetMinSize((int(size[0] / 2), int(size[1] / 2))) self.SetSizerAndFit(self.sizer) self._updateScrollBars() self.Show(True)
def __init__(self, *args, **kwargs): super(self.__class__, self).__init__(*args, **kwargs) self.mywh = Wallhaven([], '') # Inherits a Directory class and sets the path as '/tmp' if no config file is loaded self.dire = Directory(self.mywh.loadpath()) self.panel = wx.Panel(self) vbox = wx.BoxSizer(wx.VERTICAL) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox2 = wx.BoxSizer(wx.HORIZONTAL) self.lv = wx.ListView(self.panel, wx.ID_ANY, style=wx.LC_REPORT) self.lv.InsertColumn(0, 'Path') for el in self.dire.GetimageFiles(): self.lv.Append([el]) self.lv.SetColumnWidth(0, wx.LIST_AUTOSIZE) self.pages = wx.SpinCtrl(self.panel, wx.ID_ANY, min=1) self.resolution = wx.TextCtrl(self.panel, wx.NewId(), value='x'.join( map(str, list(wx.DisplaySize())))) self.pathinput = wx.TextCtrl(self.panel, id=wx.ID_ANY, value=self.dire.path) self.searchterm = wx.TextCtrl(self.panel, id=wx.ID_ANY) self.download = wx.Button(self.panel, id=wx.ID_ANY, label="Fire") hbox.Add(wx.StaticText(self.panel, label='Save Path'), 0, 5) hbox.Add(self.pathinput, 1, wx.ALL, 5) hbox.Add(wx.StaticText(self.panel, label='Search term'), 0, 5) hbox.Add(self.searchterm, 1, wx.ALL, 5) hbox.Add(wx.StaticText(self.panel, label="Screen size"), 0, 5) hbox.Add(self.resolution, 0, wx.ALL, 5) hbox.Add(wx.StaticText(self.panel, label="Page number"), 0, 5) hbox.Add(self.pages, 0, wx.ALL, 5) hbox.Add(self.download, 0, wx.ALL, 5) #self.png = wx.Image('/', type=wx.BITMAP_TYPE_ANY) self.png = wx.EmptyImage(300, 300, clear=True) #self.image = wx.StaticBitmap(self.panel, -1, self.png.Scale(300, 300).ConvertToBitmap()) self.image = wx.StaticBitmap(self.panel, -1, self.png.ConvertToBitmap()) hbox2.Add(self.lv, 2, wx.ALIGN_LEFT | wx.EXPAND | wx.ALL, 5) hbox2.Add(self.image, 1, wx.ALIGN_RIGHT | wx.ALL | wx.EXPAND, 5) self.wall = Wallhaven([], '') vbox.Add(hbox, 1, wx.ALL | wx.EXPAND, 5) vbox.Add(hbox2, 0, wx.ALL | wx.EXPAND | wx.TOP, 5) self.panel.SetSizer(vbox) vbox.Fit(self) self.Bind(wx.EVT_CLOSE, self.OnClose) self.lv.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.MouseRightClick) self.download.Bind(wx.EVT_BUTTON, self.Fire) self.lv.Bind(wx.EVT_LIST_ITEM_SELECTED, self.DrawImage) self.Show(True)