def __init__(self, parent, name='BaseGuestDataFrame'): QFrame.__init__(self, parent, name) self.guestid = None numrows = 2 numcols = 2 margin = 0 space = 1 self.grid = QGridLayout(self, numrows, numcols, margin, space, 'BaseGuestDataLayout') self.app = get_application_pointer() self.fname_lbl = QLabel('First Name', self) self.fname_entry = KLineEdit('', self) self.grid.addWidget(self.fname_lbl, 0, 0) self.grid.addWidget(self.fname_entry, 1, 0) self.lname_lbl = QLabel('Last Name', self) self.lname_entry = KLineEdit('', self) self.grid.addWidget(self.lname_lbl, 0, 1) self.grid.addWidget(self.lname_entry, 1, 1) self.title_lbl = QLabel('Title', self) self.title_entry = KLineEdit('', self) self.grid.addMultiCellWidget(self.title_lbl, 2, 2, 0, 1) self.grid.addMultiCellWidget(self.title_entry, 3, 3, 0, 1) self.desc_lbl = QLabel('Description', self) self.desc_entry = KTextEdit(self, 'description_entry') self.grid.addMultiCellWidget(self.desc_lbl, 4, 4, 0, 1) self.grid.addMultiCellWidget(self.desc_entry, 5, 7, 0, 1)
def __init__(self, parent, name='SuiteTraitComboBox'): QFrame.__init__(self, parent, name) self.app = get_application_pointer() self.conn = self.app.conn self.suiteCursor = Suites(self.conn) self.suites = self.suiteCursor.list() self.traits = Traits(self.conn, self.suites[0]) self.scombo = KComboBox(self, 'SuiteComboBox') self.scombo.insertStrList(self.suites) self.tcombo = KComboBox(self, 'TypeComboBox') self.tcombo.insertStrList(['template', 'script']) self.trcombo = KComboBox(self, 'TraitComboBox') self.update_btn = KPushButton('update', self) self.listView = TraitListView(self) self.vbox = QVBoxLayout(self) for attribute in [ 'listView', 'scombo', 'tcombo', 'trcombo', 'update_btn' ]: widget = getattr(self, attribute) self.vbox.addWidget(widget) # we need to redo the signals and the methods that are called self.connect(self.scombo, SIGNAL('activated(int)'), self.update_traits) self.connect(self.update_btn, SIGNAL('clicked()'), self.refreshlistView)
def __init__(self, parent, name='BaseGuestAppearanceFrame'): QFrame.__init__(self, parent, name) margin = 0 space = 1 self.grid = QGridLayout(self, 4, 1, margin, space) self.appearance_lbl = QLabel('Appearance', self) self.appearance_url = KLineEdit('', self) row = 0 for widget in [self.appearance_lbl, self.appearance_url]: self.grid.addWidget(widget, row, 0) row += 1
def __init__(self, parent, fields, text=None, name='EditableRecordFrame'): QFrame.__init__(self, parent, name) numrows = len(fields) +2 numcols = 2 self.grid = QGridLayout(self, numrows, numcols, 1, -1, name) self.fields = fields self.entries = {} self._setupfields() self.grid.setSpacing(7) self.grid.setMargin(10) self.text_label = QLabel(text, self) self.grid.addMultiCellWidget(self.text_label, 0, 0, 0, 1)
def __init__(self, parent, fields, text=None, name='EditableRecordFrame'): QFrame.__init__(self, parent, name) numrows = len(fields) + 2 numcols = 2 self.grid = QGridLayout(self, numrows, numcols, 1, -1, name) self.fields = fields self.entries = {} self._setupfields() self.grid.setSpacing(7) self.grid.setMargin(10) self.text_label = QLabel(text, self) self.grid.addMultiCellWidget(self.text_label, 0, 0, 0, 1)
def __init__(self, parent, name='BaseGuestPictureFrame'): QFrame.__init__(self, parent, name) margin = 0 space = 1 self.grid = QGridLayout(self, 2, 2, margin, space) self.picture_lbl = QLabel('Picture', self) self.picture_url = KLineEdit('', self) self.picture_btn = KPushButton(KStdGuiItem.Open(), 'Browse for picture', self) self.grid.addMultiCellWidget(self.picture_lbl, 0, 0, 0, 1) self.grid.addWidget(self.picture_url, 0, 1) self.grid.addWidget(self.picture_btn, 1, 1)
def __init__(self, parent, name='BaseGuestWorksFrame'): QFrame.__init__(self, parent, name) self.works_entries = [] margin = 0 space = 1 self.grid = QGridLayout(self, 2, 6, margin, space) self.works_lbl = QLabel('Works', self) self.grid.addMultiCellWidget(self.works_lbl, 0, 0, 0, 4) self.add_works_btn = KPushButton('+', self, 'add_works_button') self.add_works_btn.connect(self.add_works_btn, SIGNAL('clicked()'), self.add_works_entries) self.grid.addWidget(self.add_works_btn, 0, 5)
def __init__(self, parent, diff_type='trait', name='BaseDifferFrame'): QFrame.__init__(self, parent, name) self.diff_type = diff_type if self.diff_type == 'trait': boxtype = SuiteTraitComboBox elif self.diff_type == 'family': boxtype = FamilyList else: raise ValueError, 'unknown diff_type %s' % self.diff_type self.leftBox = boxtype(self, 'leftBox') self.rightBox = boxtype(self, 'rightBox') self.vbox = QVBoxLayout(self) margin = 5 self.list_hbox = QHBoxLayout(self.vbox, margin) self.list_hbox.addWidget(self.leftBox) self.list_hbox.addWidget(self.rightBox)
def __init__(self, parent, name='BaseEntityDataFrame'): QFrame.__init__(self, parent, name) self.entityid = None numrows = 5 numcols = 1 margin = 0 space = 1 self.grid = QGridLayout(self, numrows, numcols, margin, space, 'BaseEntityDataLayout') self.app = get_application_pointer() self.lbl = QLabel('Select the tags', self) self.grid.addWidget(self.lbl, 0, 0) self.listView = KListView(self) self.listView.addColumn('tagname', -1) self.listView.clear() self.grid.addMultiCellWidget(self.listView, 1, 4, 0, 0)
def __init__(self, parent, fields, name='SimpleRecordDialog'): KDialogBase.__init__(self, parent, name) self.page = QFrame(self) self.setMainWidget(self.page) text = 'this is a <em>simple</em> record dialog' self.grid = SimpleRecord(self.page, fields, text, name=name) self.showButtonApply(False) self.setButtonOKText('insert', 'insert') self.show()
def __init__(self, parent, name='BaseWorksEntryFrame'): QFrame.__init__(self, parent, name) margin = 0 space = 1 self.grid = QGridLayout(self, 6, 1, margin, space) self.worktype_lbl = QLabel('Work Type', self) self.worktype_entry = KLineEdit('website', self) self.title_lbl = QLabel('Title', self) self.title_entry = KLineEdit('', self) self.url_lbl = QLabel('Url', self) self.url_entry = KLineEdit('', self) row = 0 for widget in [self.worktype_lbl, self.worktype_entry, self.title_lbl, self.title_entry, self.url_lbl, self.url_entry]: self.grid.addWidget(widget, row, 0) row += 1
def __init__(self, parent, fields, text=None, record=None, name='BaseRecordFrame'): QFrame.__init__(self, parent, name) numrows = len(fields) + 1 numcols = 2 margin = 10 space = 7 self.grid = QGridLayout(self, numrows, numcols, margin, space, name) self.fields = fields self.entries = {} #self.grid.setSpacing(7) #self.grid.setMargin(10) self.record = record # need to explain refbuttons and refdata somewhere self._refbuttons = {} self._setup_fields(text)
def __init__(self, parent, name='SuiteTraitComboBox'): QFrame.__init__(self, parent, name) self.app = get_application_pointer() self.conn = self.app.conn self.suiteCursor = Suites(self.conn) self.suites = self.suiteCursor.list() self.traits = Traits(self.conn, self.suites[0]) self.scombo = KComboBox(self, 'SuiteComboBox') self.scombo.insertStrList(self.suites) self.tcombo = KComboBox(self, 'TypeComboBox') self.tcombo.insertStrList(['template', 'script']) self.trcombo = KComboBox(self, 'TraitComboBox') self.update_btn = KPushButton('update', self) self.listView = TraitListView(self) self.vbox = QVBoxLayout(self) for attribute in ['listView', 'scombo', 'tcombo', 'trcombo', 'update_btn']: widget = getattr(self, attribute) self.vbox.addWidget(widget) # we need to redo the signals and the methods that are called self.connect(self.scombo, SIGNAL('activated(int)'), self.update_traits) self.connect(self.update_btn, SIGNAL('clicked()'), self.refreshlistView)
def __init__(self, app, parent, profile): KMainWindow.__init__(self, parent, 'TraitAssigner') self.page = QFrame(self) self.vbox = QVBoxLayout(self.page, 5, 7) self.listBox = KActionSelector(self.page) self.listBox.setShowUpDownButtons(True) self.setCentralWidget(self.page) self.vbox.addWidget(self.listBox) hbox = QHBoxLayout(self.page, 5, 7) self.vbox.addLayout(hbox) self.ok_button = KPushButton('ok', self.page) self.cancel_button = KPushButton('cancel', self.page) hbox.addWidget(self.ok_button) hbox.addWidget(self.cancel_button) self.app = app self.db = app.db self.profile = Profile(app.conn) self.profile.set_profile(profile) self.suite = self.profile.current.suite self.traits = StatementCursor(app.conn) self.traits.set_table('%s_traits' % self.suite) self.initlistView() self.show()
def __init__(self, *args): QFrame.__init__(self, *args) self.app = get_application_pointer()
def __init__(self, parent, name='BaseGameDataFrame'): QFrame.__init__(self, parent, name) # there will be more than two rows, but we'll start with two numrows = 2 # there should onlty be two columns numcols = 2 margin = 0 space = 1 # add a grid layout to the frame self.grid = QGridLayout(self, numrows, numcols, margin, space, 'BaseGameDataLayout') # make a couple of lists to point to the weblink entries # order is important in these lists self.weblink_site_entries = [] self.weblink_url_entries = [] # I may use dict[site] = (site_entry, url_entry) # I haven't decided yet. It could always be formed by zipping the 2 lists above. self.weblink_dict = {} # setup app pointer self.app = KApplication.kApplication() self.myconfig = self.app.myconfig # setup dialog pointers self.select_launch_command_dlg = None # Setup widgets # setup name widgets self.name_lbl = QLabel('<b>Name</b>', self) self.name_entry = KLineEdit('', self) # add name widgets to grid self.grid.addWidget(self.name_lbl, 0, 0) self.grid.addWidget(self.name_entry, 1, 0) # setup fullname widgets self.fullname_lbl = QLabel('<b>Full name</b>', self) self.fullname_entry = KLineEdit('', self) # add fullname widgets self.grid.addWidget(self.fullname_lbl, 2, 0) self.grid.addWidget(self.fullname_entry, 3, 0) # setup description widgets self.desc_lbl = QLabel('<b>Description</b>', self) self.desc_entry = KTextEdit(self, 'description_entry') # set plain text format for description entry # we do this in case there are html tags in the entry self.desc_entry.setTextFormat(self.PlainText) # add description widgets self.grid.addWidget(self.desc_lbl, 4, 0) #self.addWidget(self.desc_entry, 5, 0) # add the description as a multirow entity # default from 5 to 15 # this allows for weblinks to be added # (about 5) # without the dialog looking ugly # going to 15 won't force there to be that many rows # until more enough widgets are added self.grid.addMultiCellWidget(self.desc_entry, 5, 15, 0, 0) # setup launch command widgets self.launch_lbl = QLabel('<b>Launch command</b>', self) self.launch_entry = KLineEdit('', self) self.launch_dlg_button = KPushButton('...', self, 'launch_dlg_button') self.launch_dlg_button.connect(self.launch_dlg_button, SIGNAL('clicked()'), self.select_launch_command) # add launch command widgets self.grid.addWidget(self.launch_lbl, 0, 1) self.grid.addWidget(self.launch_entry, 1, 1) self.grid.addWidget(self.launch_dlg_button, 1, 2) # setup dosboxpath widgets self.dosboxpath_lbl = QLabel('<b>dosbox path</b>', self) self.dosboxpath_entry = KLineEdit('', self) # add dosboxpath widgets self.grid.addWidget(self.dosboxpath_lbl, 2, 1) self.grid.addWidget(self.dosboxpath_entry, 3, 1) # setup main weblink widgets self.weblinks_lbl = QLabel('<b>weblinks</b>', self) self.weblinks_btn = KPushButton('+', self, 'add_weblink_button') self.weblinks_btn.connect(self.weblinks_btn, SIGNAL('clicked()'), self.add_weblink_entries) # add main weblink widgets self.grid.addWidget(self.weblinks_lbl, 4, 1) self.grid.addWidget(self.weblinks_btn, 4, 2)