Esempio n. 1
0
	def __init__(self, parent):
		WizardPage.__init__(self, parent, pgid.GREETING)

		m1 = GT(u'Welcome to Debreate!')
		m2 = GT(u'Debreate aids in building packages for installation on Debian based systems. Use the arrows located in the top-right corner or the "Page" menu to navigate through the program. For some information on Debian packages use the reference links in the "Help" menu.')
		m3 = GT(u'For a video tutorial check the link below.')
		str_info = u'{}\n\n{}\n\n{}'.format(m1, m2, m3)

		# --- Information to be displayed about each mode
		txt_info = wx.StaticText(self, label=str_info)
		# Keep characters within the width of the window
		txt_info.Wrap(600)

		lnk_video = Hyperlink(self, wx.ID_ANY, GT(u'Building a Debian Package with Debreate'),
				u'http://www.youtube.com/watch?v=kx4D5eL6HKE')
		lnk_video.SetToolTipString(lnk_video.url)

		# *** Layout *** #

		lyt_info = wx.GridSizer()
		lyt_info.Add(txt_info, 1, wx.ALIGN_CENTER|wx.ALIGN_CENTER_VERTICAL)

		lyt_main = BoxSizer(wx.VERTICAL)
		lyt_main.Add(lyt_info, 4, wx.ALIGN_CENTER|wx.ALL, 10)
		lyt_main.Add(lnk_video, 2, wx.ALIGN_CENTER)

		self.SetAutoLayout(True)
		self.SetSizer(lyt_main)
		self.Layout()
Esempio n. 2
0
    def __init__(self, parent):
        WizardPage.__init__(self, parent, pgid.LAUNCHERS)

        ## Override default label
        self.Label = GT(u'Menu Launchers')

        self.IgnoreResetIds = [
            inputid.OTHER,
            listid.CAT,
        ]

        templates = MultiTemplate(self, LauncherTemplate, pnlid.TABS)

        templates.RenameButton(btnid.ADD, GT(u'Add Launcher'))
        templates.RenameButton(btnid.RENAME, GT(u'Rename Launcher'))

        SetPageToolTips(self)

        # *** Event Handling *** #

        wx.EVT_BUTTON(self, wx.ID_ADD, self.OnAddTab)

        # *** Layout *** #

        lyt_main = BoxSizer(wx.VERTICAL)
        lyt_main.Add(templates, 1, wx.EXPAND | wx.ALL, 5)

        self.SetAutoLayout(True)
        self.SetSizer(lyt_main)
        self.Layout()
Esempio n. 3
0
    def __init__(self, parent):
        # TODO: Add to Gettext locale files
        WizardPage.__init__(self, parent, pgid.MAN)

        ## Override default label
        self.Label = GT(u'Manual Pages')

        self.Tabs = MultiTemplate(self, ManPage)

        self.Tabs.RenameButton(btnid.ADD, GT(u'Add Manual'))
        self.Tabs.RenameButton(btnid.RENAME, GT(u'Rename Manual'))
        self.Tabs.AddTabButton(GT(u'Switch Mode'), u'mode', btnid.MODE,
                               self.OnChangeMode)

        # FIXME: Call after new page added???
        SetPageToolTips(self)

        # *** Layout *** #

        lyt_main = BoxSizer(wx.VERTICAL)
        lyt_main.Add(self.Tabs, 1, wx.EXPAND | wx.ALL, 5)

        self.SetAutoLayout(True)
        self.SetSizer(lyt_main)
        self.Layout()
Esempio n. 4
0
    def __init__(self, parent):
        WizardPage.__init__(self, parent, pgid.CONTROL)

        # *** Layout *** #

        lyt_main = BoxSizer(wx.VERTICAL)

        self.SetAutoLayout(True)
        self.SetSizer(lyt_main)
        self.Layout()
Esempio n. 5
0
	def __init__(self, parent):
		WizardPage.__init__(self, parent, pgid.CONTROL)

		# *** Layout *** #

		lyt_main = BoxSizer(wx.VERTICAL)

		self.SetAutoLayout(True)
		self.SetSizer(lyt_main)
		self.Layout()
Esempio n. 6
0
    def __init__(self, parent):
        WizardPage.__init__(self, parent, pgid.GREETING)

        # Bypass checking this page for build
        self.prebuild_check = False

        m1 = GT(u'Welcome to Debreate!')
        m2 = GT(
            u'Debreate aids in building packages for installation on Debian based systems. Use the arrows located in the top-right corner or the "Page" menu to navigate through the program. For some information on Debian packages use the reference links in the "Help" menu.'
        )
        m3 = GT(u'For a video tutorial check the link below.')
        txt_bin = u'{}\n\n{}\n\n{}'.format(m1, m2, m3)
        txt_src = u'This mode is not fully functional'
        txt_upd = u'This mode is not fully functional'

        self.mode_info = (
            (
                u'Build Package from Precompiled Files',
                txt_bin,
            ),
            (
                u'Build Debian Source Package',
                txt_src,
            ),
            (
                u'Update a Package',
                txt_upd,
            ),
        )

        # --- Information to be displayed about each mode
        self.txt_info = wx.StaticText(self)

        lnk_video = Hyperlink(self, wx.ID_ANY,
                              GT(u'Building a Debian Package with Debreate'),
                              u'http://www.youtube.com/watch?v=kx4D5eL6HKE')
        lnk_video.SetToolTipString(lnk_video.url)

        # *** Layout *** #

        lyt_info = wx.GridSizer()
        lyt_info.Add(self.txt_info, 1,
                     wx.ALIGN_CENTER | wx.ALIGN_CENTER_VERTICAL)

        lyt_main = BoxSizer(wx.VERTICAL)
        lyt_main.Add(lyt_info, 4, wx.ALIGN_CENTER | wx.ALL, 10)
        lyt_main.Add(lnk_video, 2, wx.ALIGN_CENTER)

        self.SetAutoLayout(True)
        self.SetSizer(lyt_main)
        self.Layout()
Esempio n. 7
0
	def __init__(self, parent):
		WizardPage.__init__(self, parent, pgid.GREETING)

		# Bypass checking this page for build
		self.prebuild_check = False

		m1 = GT(u'Welcome to Debreate!')
		m2 = GT(u'Debreate aids in building packages for installation on Debian based systems. Use the arrows located in the top-right corner or the "Page" menu to navigate through the program. For some information on Debian packages use the reference links in the "Help" menu.')
		m3 = GT(u'For a video tutorial check the link below.')
		txt_bin = u'{}\n\n{}\n\n{}'.format(m1, m2, m3)
		txt_src = u'This mode is not fully functional'
		txt_upd = u'This mode is not fully functional'

		self.mode_info = (
			(u'Build Package from Precompiled Files', txt_bin,),
			(u'Build Debian Source Package', txt_src,),
			(u'Update a Package', txt_upd,),
			)

		# --- Information to be displayed about each mode
		self.txt_info = wx.StaticText(self)

		lnk_video = Hyperlink(self, wx.ID_ANY, GT(u'Building a Debian Package with Debreate'),
				u'http://www.youtube.com/watch?v=kx4D5eL6HKE')
		lnk_video.SetToolTipString(lnk_video.url)

		# *** Layout *** #

		lyt_info = wx.GridSizer()
		lyt_info.Add(self.txt_info, 1, wx.ALIGN_CENTER|wx.ALIGN_CENTER_VERTICAL)

		lyt_main = BoxSizer(wx.VERTICAL)
		lyt_main.Add(lyt_info, 4, wx.ALIGN_CENTER|wx.ALL, 10)
		lyt_main.Add(lnk_video, 2, wx.ALIGN_CENTER)

		self.SetAutoLayout(True)
		self.SetSizer(lyt_main)
		self.Layout()
Esempio n. 8
0
	def __init__(self, parent):
		# TODO: Add to Gettext locale files
		WizardPage.__init__(self, parent, pgid.MAN)

		## Override default label
		self.Label = GT(u'Manual Pages')

		self.Tabs = MultiTemplate(self, ManPage)

		self.Tabs.RenameButton(btnid.ADD, GT(u'Add Manual'))
		self.Tabs.RenameButton(btnid.RENAME, GT(u'Rename Manual'))
		self.Tabs.AddTabButton(GT(u'Switch Mode'), u'mode', btnid.MODE, self.OnChangeMode)

		# FIXME: Call after new page added???
		SetPageToolTips(self)

		# *** Layout *** #

		lyt_main = BoxSizer(wx.VERTICAL)
		lyt_main.Add(self.Tabs, 1, wx.EXPAND|wx.ALL, 5)

		self.SetAutoLayout(True)
		self.SetSizer(lyt_main)
		self.Layout()
Esempio n. 9
0
	def __init__(self, parent):
		WizardPage.__init__(self, parent, pgid.SCRIPTS)

		preinst = DebianScript(self, ID_INST_PRE)
		postinst = DebianScript(self, ID_INST_POST)
		prerm = DebianScript(self, ID_RM_PRE)
		postrm = DebianScript(self, ID_RM_POST)

		# Radio buttons for displaying between pre- and post- install scripts
		# FIXME: Names settings for tooltips are confusing
		rb_preinst = wx.RadioButton(self, preinst.GetId(), preinst.GetName(),
				name=preinst.FileName, style=wx.RB_GROUP)
		rb_postinst = wx.RadioButton(self, postinst.GetId(), postinst.GetName(),
				name=postinst.FileName)
		rb_prerm = wx.RadioButton(self, prerm.GetId(), prerm.GetName(),
				name=prerm.FileName)
		rb_postrm = wx.RadioButton(self, postrm.GetId(), postrm.GetName(),
				name=postrm.FileName)

		self.script_objects = (
			(preinst, rb_preinst,),
			(postinst, rb_postinst,),
			(prerm, rb_prerm,),
			(postrm, rb_postrm,),
			)

		# *** Auto-Link *** #

		pnl_autolink = BorderedPanel(self)

		# Auto-Link path for new link
		txt_autolink = wx.StaticText(pnl_autolink, label=GT(u'Path'), name=u'target')
		self.ti_autolink = PathCtrl(pnl_autolink, value=u'/usr/bin', warn=True)
		self.ti_autolink.SetName(u'target')
		self.ti_autolink.Default = self.ti_autolink.GetValue()

		# Auto-Link executables to be linked
		self.Executables = BasicFileList(pnl_autolink, size=(200, 200), hlExe=True,
				name=u'al list')

		# Auto-Link import, generate and remove buttons
		btn_al_import = CreateButton(pnl_autolink, btnid.IMPORT)
		btn_al_remove = CreateButton(pnl_autolink, btnid.REMOVE)
		btn_al_generate = CreateButton(pnl_autolink, image=u'build')

		# Auto-Link help
		btn_help = CreateButton(pnl_autolink, btnid.HELP, size=64)

		# Initialize script display
		self.ScriptSelect(None)

		SetPageToolTips(self)

		# *** Event Handling *** #

		for DS, RB in self.script_objects:
			wx.EVT_RADIOBUTTON(RB, RB.GetId(), self.ScriptSelect)

		wx.EVT_BUTTON(btn_al_import, btnid.IMPORT, self.ImportExes)
		wx.EVT_BUTTON(btn_al_generate, wx.ID_ANY, self.OnGenerate)
		wx.EVT_BUTTON(btn_al_remove, btnid.REMOVE, self.ImportExes)
		wx.EVT_BUTTON(btn_help, btnid.HELP, self.OnHelpButton)

		# *** Layout *** #

		# Organizing radio buttons
		lyt_sel_script = BoxSizer(wx.HORIZONTAL)
		lyt_sel_script.AddMany((
			(rb_preinst),
			(rb_postinst),
			(rb_prerm),
			(rb_postrm),
			))

		# Sizer for left half of scripts panel
		lyt_left = BoxSizer(wx.VERTICAL)
		lyt_left.Add(lyt_sel_script, 0, wx.EXPAND|wx.BOTTOM, 5)

		for DS, RB in self.script_objects:
			lyt_left.Add(DS, 1, wx.EXPAND)

		# Auto-Link/Right side
		lyt_ti_autolink = BoxSizer(wx.HORIZONTAL)
		lyt_ti_autolink.Add(txt_autolink, 0, lyt.ALGN_C)
		lyt_ti_autolink.Add(self.ti_autolink, 1, lyt.ALGN_C)

		lyt_btn_autolink = BoxSizer(wx.HORIZONTAL)
		lyt_btn_autolink.Add(btn_al_import, 0)
		lyt_btn_autolink.Add(btn_al_remove, 0, lyt.PAD_LR, 5)
		lyt_btn_autolink.Add(btn_al_generate, 0)

		lyt_autolink = BoxSizer(wx.VERTICAL)
		lyt_autolink.Add(lyt_ti_autolink, 0, wx.EXPAND|lyt.PAD_LRT, 5)
		lyt_autolink.Add(self.Executables, 3, wx.EXPAND|lyt.PAD_LRT, 5)
		lyt_autolink.Add(lyt_btn_autolink, 0, lyt.ALGN_CH)
		lyt_autolink.Add(btn_help, 1, lyt.ALGN_C)

		pnl_autolink.SetSizer(lyt_autolink)
		pnl_autolink.SetAutoLayout(True)
		pnl_autolink.Layout()

		# Sizer for right half of scripts panel
		lyt_right = BoxSizer(wx.VERTICAL)
		# Line up panels to look even
		lyt_right.AddSpacer(44)
		lyt_right.Add(wx.StaticText(self, label=GT(u'Auto-Link Executables')),
				0, lyt.ALGN_LB)
		lyt_right.Add(pnl_autolink, 0, wx.EXPAND)

		lyt_main = BoxSizer(wx.HORIZONTAL)
		lyt_main.Add(lyt_left, 1, wx.EXPAND|wx.ALL, 5)
		lyt_main.Add(lyt_right, 0, wx.ALL, 5)

		self.SetAutoLayout(True)
		self.SetSizer(lyt_main)
		self.Layout()
Esempio n. 10
0
	def __init__(self, parent):
		WizardPage.__init__(self, parent, pgid.FILES)

		# *** Left Panel *** #

		pnl_treeopts = BorderedPanel(self)

		self.chk_individuals = CheckBoxCFG(pnl_treeopts, label=GT(u'List files individually'),
				name=u'individually', cfgSect=u'FILES')

		self.chk_preserve_top = CheckBoxCFG(pnl_treeopts, chkid.TOPLEVEL, GT(u'Preserve top-level directories'),
				name=u'top-level', cfgSect=u'FILES')

		self.chk_nofollow_symlink = CheckBoxCFG(pnl_treeopts, chkid.SYMLINK, GT(u'Don\'t follow symbolic links'),
				defaultValue=True, name=u'nofollow-symlink', cfgSect=u'FILES')

		self.tree_dirs = DirectoryTreePanel(self, size=(300,20))

		# ----- Target path
		pnl_target = BorderedPanel(self)

		# choices of destination
		rb_bin = wx.RadioButton(pnl_target, label=u'/bin', style=wx.RB_GROUP)
		rb_usrbin = wx.RadioButton(pnl_target, label=u'/usr/bin')
		rb_usrlib = wx.RadioButton(pnl_target, label=u'/usr/lib')
		rb_locbin = wx.RadioButton(pnl_target, label=u'/usr/local/bin')
		rb_loclib = wx.RadioButton(pnl_target, label=u'/usr/local/lib')
		self.rb_custom = wx.RadioButton(pnl_target, inputid.CUSTOM, GT(u'Custom'))
		self.rb_custom.Default = True

		# Start with "Custom" selected
		self.rb_custom.SetValue(self.rb_custom.Default)

		# group buttons together
		# FIXME: Unnecessary???
		self.grp_targets = (
			rb_bin,
			rb_usrbin,
			rb_usrlib,
			rb_locbin,
			rb_loclib,
			self.rb_custom,
			)

		# ----- Add/Remove/Clear buttons
		btn_add = CreateButton(self, btnid.ADD)
		btn_remove = CreateButton(self, btnid.REMOVE)
		btn_clear = CreateButton(self, btnid.CLEAR)

		self.prev_dest_value = u'/usr/bin'
		self.ti_target = TextArea(self, defaultValue=self.prev_dest_value, name=u'target')

		self.btn_browse = CreateButton(self, btnid.BROWSE)
		btn_refresh = CreateButton(self, btnid.REFRESH)

		# Display area for files added to list
		self.lst_files = FileListESS(self, inputid.LIST, name=u'filelist')

		# *** Event Handling *** #

		# create an event to enable/disable custom widget
		for item in self.grp_targets:
			wx.EVT_RADIOBUTTON(item, wx.ID_ANY, self.OnSetDestination)

		# Context menu events for directory tree
		wx.EVT_MENU(self, wx.ID_ADD, self.OnImportFromTree)

		# Button events
		btn_add.Bind(wx.EVT_BUTTON, self.OnImportFromTree)
		btn_remove.Bind(wx.EVT_BUTTON, self.OnRemoveSelected)
		btn_clear.Bind(wx.EVT_BUTTON, self.OnClearFileList)
		self.btn_browse.Bind(wx.EVT_BUTTON, self.OnBrowse)
		btn_refresh.Bind(wx.EVT_BUTTON, self.OnRefreshFileList)

		# ???: Not sure what these do
		wx.EVT_KEY_DOWN(self.ti_target, self.GetDestValue)
		wx.EVT_KEY_UP(self.ti_target, self.CheckDest)

		# Key events for file list
		wx.EVT_KEY_DOWN(self.lst_files, self.OnRemoveSelected)

		self.Bind(wx.EVT_DROP_FILES, self.OnDropFiles)

		# *** Layout *** #

		lyt_treeopts = BoxSizer(wx.VERTICAL)
		lyt_treeopts.AddSpacer(5)
		lyt_treeopts.Add(self.chk_individuals, 0, lyt.PAD_LR, 5)
		lyt_treeopts.Add(self.chk_preserve_top, 0, lyt.PAD_LR, 5)
		lyt_treeopts.Add(self.chk_nofollow_symlink, 0, lyt.PAD_LR, 5)
		lyt_treeopts.AddSpacer(5)

		pnl_treeopts.SetSizer(lyt_treeopts)

		lyt_left = BoxSizer(wx.VERTICAL)
		lyt_left.AddSpacer(10)
		lyt_left.Add(wx.StaticText(self, label=GT(u'Directory options')), 0, wx.ALIGN_BOTTOM)
		lyt_left.Add(pnl_treeopts, 0, wx.EXPAND|wx.ALIGN_LEFT|wx.BOTTOM, 5)
		lyt_left.Add(self.tree_dirs, 1, wx.EXPAND)

		lyt_target = wx.GridSizer(3, 2, 5, 5)

		for item in self.grp_targets:
			lyt_target.Add(item, 0, lyt.PAD_LR, 5)

		pnl_target.SetAutoLayout(True)
		pnl_target.SetSizer(lyt_target)
		pnl_target.Layout()

		# Put text input in its own sizer to force expand
		lyt_input = BoxSizer(wx.HORIZONTAL)
		lyt_input.Add(self.ti_target, 1, wx.ALIGN_CENTER_VERTICAL)

		lyt_buttons = BoxSizer(wx.HORIZONTAL)
		lyt_buttons.Add(btn_add, 0)
		lyt_buttons.Add(btn_remove, 0)
		lyt_buttons.Add(btn_clear, 0)
		lyt_buttons.Add(lyt_input, 1, wx.ALIGN_CENTER_VERTICAL)
		lyt_buttons.Add(self.btn_browse, 0)
		lyt_buttons.Add(btn_refresh, 0)

		lyt_right = BoxSizer(wx.VERTICAL)
		lyt_right.AddSpacer(10)
		lyt_right.Add(wx.StaticText(self, label=GT(u'Target')))
		lyt_right.Add(pnl_target, 0, wx.TOP, 5)
		lyt_right.Add(lyt_buttons, 0, wx.EXPAND)
		lyt_right.Add(self.lst_files, 5, wx.EXPAND|wx.TOP, 5)

		PROP_LEFT = 0
		PROP_RIGHT = 1

		lyt_main = wx.FlexGridSizer(1, 2)
		lyt_main.AddGrowableRow(0)

		# Directory tree size issues with wx 2.8
		if wx.MAJOR_VERSION <= 2:
			PROP_LEFT = 1
			lyt_main.AddGrowableCol(0, 1)

		lyt_main.AddGrowableCol(1, 2)
		lyt_main.Add(lyt_left, PROP_LEFT, wx.EXPAND|lyt.PAD_LR|wx.BOTTOM, 5)
		lyt_main.Add(lyt_right, PROP_RIGHT, wx.EXPAND|lyt.PAD_RB, 5)

		self.SetAutoLayout(True)
		self.SetSizer(lyt_main)
		self.Layout()

		SetPageToolTips(self)
Esempio n. 11
0
    def __init__(self, parent):
        WizardPage.__init__(self, parent, pgid.BUILD)

        # Bypass build prep check
        self.prebuild_check = False

        # Add checkable items to this list
        # FIXME: Use a different method
        self.build_options = []

        # ----- Extra Options

        pnl_options = BorderedPanel(self)

        self.chk_md5 = CheckBoxESS(pnl_options,
                                   chkid.MD5,
                                   GT(u'Create md5sums file'),
                                   name=u'MD5',
                                   defaultValue=True,
                                   commands=u'md5sum')
        # The » character denotes that an alternate tooltip should be shown if the control is disabled
        self.chk_md5.tt_name = u'md5»'
        self.chk_md5.col = 0

        if UsingTest(u'alpha'):
            # Brings up control file preview for editing
            self.chk_editctrl = CheckBoxCFG(
                pnl_options,
                chkid.EDIT,
                GT(u'Preview control file for editing'),
                name=u'editctrl')
            self.chk_editctrl.col = 1

        # TODO: Use CheckBoxCFG instead of CheckBoxESS:
        #		   Fields will be set from config instead of project file

        # Option to strip binaries
        self.chk_strip = CheckBoxESS(pnl_options,
                                     chkid.STRIP,
                                     GT(u'Strip binaries'),
                                     name=u'strip»',
                                     defaultValue=True,
                                     commands=u'strip')
        self.chk_strip.col = 0

        # Deletes the temporary build tree
        self.chk_rmstage = CheckBoxESS(pnl_options,
                                       chkid.DELETE,
                                       GT(u'Delete staged directory'),
                                       name=u'RMSTAGE',
                                       defaultValue=True)
        self.chk_rmstage.col = 0

        # Checks the output .deb for errors
        self.chk_lint = CheckBoxESS(
            pnl_options,
            chkid.LINT,
            GT(u'Check package for errors with lintian'),
            name=u'LINTIAN',
            defaultValue=True,
            commands=u'lintian')
        self.chk_lint.tt_name = u'lintian»'
        self.chk_lint.col = 0

        # Installs the deb on the system
        self.chk_install = CheckBox(pnl_options,
                                    chkid.INSTALL,
                                    GT(u'Install package after build'),
                                    name=u'INSTALL',
                                    commands=(
                                        u'gdebi-gtk',
                                        u'gdebi-kde',
                                    ))
        self.chk_install.tt_name = u'install»'
        self.chk_install.col = 0

        # *** Lintian Overrides *** #

        if UsingTest(u'alpha'):
            # FIXME: Move next to lintian check box
            self.lint_overrides = []
            btn_lint_overrides = CreateButton(self,
                                              label=GT(u'Lintian overrides'))
            btn_lint_overrides.Bind(wx.EVT_BUTTON, self.OnSetLintOverrides)

        btn_build = CreateButton(self, btnid.BUILD, GT(u'Build'), u'build', 64)

        # Display log
        dsp_log = OutputLog(self)

        SetPageToolTips(self)

        # *** Event Handling *** #

        btn_build.Bind(wx.EVT_BUTTON, self.OnBuild)

        # *** Layout *** #

        lyt_options = wx.GridBagSizer()

        next_row = 0
        prev_row = next_row
        for CHK in pnl_options.Children:
            row = next_row
            FLAGS = lyt.PAD_LR

            if CHK.col:
                row = prev_row
                FLAGS = wx.RIGHT

            lyt_options.Add(CHK, (row, CHK.col), flag=FLAGS, border=5)

            if not CHK.col:
                prev_row = next_row
                next_row += 1

        pnl_options.SetSizer(lyt_options)
        pnl_options.SetAutoLayout(True)
        pnl_options.Layout()

        lyt_buttons = BoxSizer(wx.HORIZONTAL)
        lyt_buttons.Add(btn_build, 1)

        lyt_main = BoxSizer(wx.VERTICAL)
        lyt_main.AddSpacer(10)
        lyt_main.Add(wx.StaticText(self, label=GT(u'Extra Options')), 0,
                     lyt.ALGN_LB | wx.LEFT, 5)
        lyt_main.Add(pnl_options, 0, wx.LEFT, 5)
        lyt_main.AddSpacer(5)

        if UsingTest(u'alpha'):
            #lyt_main.Add(wx.StaticText(self, label=GT(u'Lintian overrides')), 0, wx.LEFT, 5)
            lyt_main.Add(btn_lint_overrides, 0, wx.LEFT, 5)

        lyt_main.AddSpacer(5)
        lyt_main.Add(lyt_buttons, 0, lyt.ALGN_C)
        lyt_main.Add(dsp_log, 2, wx.EXPAND | lyt.PAD_LRB, 5)

        self.SetAutoLayout(True)
        self.SetSizer(lyt_main)
        self.Layout()

        # *** Post-layout functions *** #

        self.InitDefaultSettings()
Esempio n. 12
0
	def __init__(self, parent):
		WizardPage.__init__(self, parent, pgid.CONTROL)

		# Bypass checking this page for build
		# This is mandatory & done manually
		self.prebuild_check = False

		self.SetScrollbars(0, 20, 0, 0)

		pnl_bg = wx.Panel(self)

		# Buttons to open, save, & preview control file
		btn_open = CreateButton(pnl_bg, btnid.BROWSE, GT(u'Browse'), u'browse', name=u'btn browse')
		btn_save = CreateButton(pnl_bg, btnid.SAVE, GT(u'Save'), u'save', name=u'btn save')
		btn_preview = CreateButton(pnl_bg, btnid.PREVIEW, GT(u'Preview'), u'preview', name=u'btn preview')

		# *** Required fields *** #

		pnl_require = BorderedPanel(pnl_bg)

		txt_package = wx.StaticText(pnl_require, label=GT(u'Package'), name=u'package')
		txt_package.req = True
		ti_package = TextAreaESS(pnl_require, inputid.PACKAGE, name=txt_package.Name)
		ti_package.req = True

		txt_version = wx.StaticText(pnl_require, label=GT(u'Version'), name=u'version')
		txt_version.req = True
		ti_version = TextAreaESS(pnl_require, inputid.VERSION, name=txt_version.Name)
		ti_version.req = True

		txt_maintainer = wx.StaticText(pnl_require, label=GT(u'Maintainer'), name=u'maintainer')
		txt_maintainer.req = True
		ti_maintainer = TextAreaESS(pnl_require, inputid.MAINTAINER, name=txt_maintainer.Name)
		ti_maintainer.req = True

		txt_email = wx.StaticText(pnl_require, label=GT(u'Email'), name=u'email')
		txt_email.req = True
		ti_email = TextAreaESS(pnl_require, inputid.EMAIL, name=txt_email.Name)
		ti_email.req = True

		opts_arch = (
			u'all', u'alpha', u'amd64', u'arm', u'arm64', u'armeb', u'armel',
			u'armhf', u'avr32', u'hppa', u'i386', u'ia64', u'lpia', u'm32r',
			u'm68k', u'mips', u'mipsel', u'powerpc', u'powerpcspe', u'ppc64',
			u's390', u's390x', u'sh3', u'sh3eb', u'sh4', u'sh4eb', u'sparc',
			u'sparc64',
			)

		txt_arch = wx.StaticText(pnl_require, label=GT(u'Architecture'), name=u'architecture')
		sel_arch = ChoiceESS(pnl_require, inputid.ARCH, choices=opts_arch, name=txt_arch.Name)
		sel_arch.Default = 0
		sel_arch.SetSelection(sel_arch.Default)

		# *** Recommended fields *** #

		pnl_recommend = BorderedPanel(pnl_bg)

		opts_section = (
			u'admin', u'cli-mono', u'comm', u'database', u'devel', u'debug',
			u'doc', u'editors', u'electronics', u'embedded', u'fonts', u'games',
			u'gnome', u'graphics', u'gnu-r', u'gnustep', u'hamradio', u'haskell',
			u'httpd', u'interpreters', u'java', u'kde', u'kernel', u'libs',
			u'libdevel', u'lisp', u'localization', u'mail', u'math',
			u'metapackages', u'misc', u'net', u'news', u'ocaml', u'oldlibs',
			u'otherosfs', u'perl', u'php', u'python', u'ruby', u'science',
			u'shells', u'sound', u'tex', u'text', u'utils', u'vcs', u'video',
			u'web', u'x11', u'xfce', u'zope',
			)

		txt_section = wx.StaticText(pnl_recommend, label=GT(u'Section'), name=u'section')
		ti_section = ComboBoxESS(pnl_recommend, choices=opts_section, name=txt_section.Name)

		opts_priority = (
			u'optional',
			u'standard',
			u'important',
			u'required',
			u'extra',
			)

		txt_priority = wx.StaticText(pnl_recommend, label=GT(u'Priority'), name=u'priority')
		sel_priority = ChoiceESS(pnl_recommend, choices=opts_priority, name=txt_priority.Name)
		sel_priority.Default = 0
		sel_priority.SetSelection(sel_priority.Default)

		txt_synopsis = wx.StaticText(pnl_recommend, label=GT(u'Short Description'), name=u'synopsis')
		ti_synopsis = TextAreaESS(pnl_recommend, name=txt_synopsis.Name)

		txt_description = wx.StaticText(pnl_recommend, label=GT(u'Long Description'), name=u'description')
		self.ti_description = TextAreaPanelESS(pnl_recommend, name=txt_description.Name)

		# *** Optional fields *** #

		pnl_option = BorderedPanel(pnl_bg)

		txt_source = wx.StaticText(pnl_option, label=GT(u'Source'), name=u'source')
		ti_source = TextAreaESS(pnl_option, name=txt_source.Name)

		txt_homepage = wx.StaticText(pnl_option, label=GT(u'Homepage'), name=u'homepage')
		ti_homepage = TextAreaESS(pnl_option, name=txt_homepage.Name)

		txt_essential = wx.StaticText(pnl_option, label=GT(u'Essential'), name=u'essential')
		self.chk_essential = CheckBoxESS(pnl_option, name=u'essential')
		self.chk_essential.Default = False

		self.grp_input = (
			ti_package,
			ti_version,
			ti_maintainer,  # Maintainer must be listed before email
			ti_email,
			ti_section,
			ti_source,
			ti_homepage,
			ti_synopsis,
			self.ti_description,
			)

		self.grp_select = (
			sel_arch,
			sel_priority,
			)

		SetPageToolTips(self)

		# *** Event Handling *** #

		btn_open.Bind(wx.EVT_BUTTON, self.OnBrowse)
		btn_save.Bind(wx.EVT_BUTTON, self.OnSave)
		btn_preview.Bind(wx.EVT_BUTTON, self.OnPreviewControl)


		# *** Layout *** #

		LEFT_BOTTOM = lyt.ALGN_LB
		RIGHT_CENTER = wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT

		# Buttons
		lyt_buttons = BoxSizer(wx.HORIZONTAL)
		lyt_buttons.Add(btn_open, 0)
		lyt_buttons.Add(btn_save, 0)
		lyt_buttons.Add(btn_preview, 0)

		# Required fields
		lyt_require = wx.FlexGridSizer(0, 4, 5, 5)
		lyt_require.AddGrowableCol(1)
		lyt_require.AddGrowableCol(3)

		lyt_require.AddMany((
			(txt_package, 0, RIGHT_CENTER|lyt.PAD_LT, 5),
			(ti_package, 0, wx.EXPAND|wx.TOP, 5),
			(txt_version, 0, RIGHT_CENTER|wx.TOP, 5),
			(ti_version, 0, wx.EXPAND|wx.TOP|wx.RIGHT, 5),
			(txt_maintainer, 0, RIGHT_CENTER|wx.LEFT, 5),
			(ti_maintainer, 0, wx.EXPAND),
			(txt_email, 0, RIGHT_CENTER, 5),
			(ti_email, 0, wx.EXPAND|wx.RIGHT, 5),
			(txt_arch, 0, RIGHT_CENTER|lyt.PAD_LB, 5),
			(sel_arch, 0, wx.BOTTOM, 5),
			))

		pnl_require.SetSizer(lyt_require)
		pnl_require.SetAutoLayout(True)
		pnl_require.Layout()

		# Recommended fields
		lyt_recommend = wx.GridBagSizer()
		lyt_recommend.SetCols(4)
		lyt_recommend.AddGrowableCol(1)
		lyt_recommend.AddGrowableRow(3)

		lyt_recommend.Add(txt_section, (0, 2), flag=RIGHT_CENTER|lyt.PAD_TB, border=5)
		lyt_recommend.Add(ti_section, (0, 3),
				flag=wx.EXPAND|lyt.PAD_RTB, border=5)
		lyt_recommend.Add(txt_synopsis, (0, 0), (1, 2), LEFT_BOTTOM|wx.LEFT, 5)
		lyt_recommend.Add(ti_synopsis, (1, 0), (1, 2), wx.EXPAND|lyt.PAD_LR, 5)
		lyt_recommend.Add(txt_priority, (1, 2), flag=RIGHT_CENTER, border=5)
		lyt_recommend.Add(sel_priority, (1, 3), flag=wx.EXPAND|wx.RIGHT, border=5)
		lyt_recommend.Add(txt_description, (2, 0), (1, 2), LEFT_BOTTOM|lyt.PAD_LT, 5)
		lyt_recommend.Add(self.ti_description, (3, 0), (1, 4),
				wx.EXPAND|lyt.PAD_LR|wx.BOTTOM, 5)

		pnl_recommend.SetSizer(lyt_recommend)
		pnl_recommend.SetAutoLayout(True)
		pnl_recommend.Layout()

		# Optional fields
		lyt_option = wx.FlexGridSizer(0, 4, 5, 5)

		lyt_option.AddGrowableCol(1)
		lyt_option.AddGrowableCol(3)
		lyt_option.AddSpacer(5)
		lyt_option.AddSpacer(5)
		lyt_option.AddSpacer(5)
		lyt_option.AddSpacer(5)
		lyt_option.AddMany((
			(txt_source, 0, RIGHT_CENTER|wx.LEFT, 5),
			(ti_source, 0, wx.EXPAND),
			(txt_homepage, 0, RIGHT_CENTER, 5),
			(ti_homepage, 0, wx.EXPAND|wx.RIGHT, 5),
			(txt_essential, 0, RIGHT_CENTER|lyt.PAD_LB, 5),
			(self.chk_essential, 0, wx.BOTTOM, 5),
			))

		pnl_option.SetSizer(lyt_option)
		pnl_option.SetAutoLayout(True)
		pnl_option.Layout()

		# Main background panel sizer
		# FIXME: Is background panel (pnl_bg) necessary
		lyt_bg = BoxSizer(wx.VERTICAL)
		lyt_bg.Add(lyt_buttons, 0, wx.ALIGN_RIGHT|wx.BOTTOM, 5)
		lyt_bg.Add(wx.StaticText(pnl_bg, label=GT(u'Required')), 0)
		lyt_bg.Add(pnl_require, 0, wx.EXPAND)
		lyt_bg.Add(wx.StaticText(pnl_bg, label=GT(u'Recommended')), 0, wx.TOP, 5)
		lyt_bg.Add(pnl_recommend, 1, wx.EXPAND)
		lyt_bg.Add(wx.StaticText(pnl_bg, label=GT(u'Optional')), 0, wx.TOP, 5)
		lyt_bg.Add(pnl_option, 0, wx.EXPAND)

		pnl_bg.SetAutoLayout(True)
		pnl_bg.SetSizer(lyt_bg)
		pnl_bg.Layout()

		# Page's main sizer
		lyt_main = BoxSizer(wx.VERTICAL)
		lyt_main.AddSpacer(5)
		lyt_main.Add(pnl_bg, 1, wx.EXPAND|lyt.PAD_LR|wx.BOTTOM, 5)

		self.SetAutoLayout(True)
		self.SetSizer(lyt_main)
		self.Layout()
Esempio n. 13
0
	def __init__(self, parent):
		WizardPage.__init__(self, parent, pgid.FILES)

		# *** Left Panel *** #

		pnl_treeopts = BorderedPanel(self)

		self.chk_individuals = CheckBoxCFG(pnl_treeopts, label=GT(u'List files individually'),
				name=u'individually', cfgSect=u'FILES')

		self.chk_preserve_top = CheckBoxCFG(pnl_treeopts, label=GT(u'Preserve top-level directories'),
				name=u'top-level', cfgSect=u'FILES')

		self.tree_dirs = DirectoryTreePanel(self, size=(300,20))

		# ----- Target path
		pnl_target = BorderedPanel(self)

		# choices of destination
		rb_bin = wx.RadioButton(pnl_target, label=u'/bin', style=wx.RB_GROUP)
		rb_usrbin = wx.RadioButton(pnl_target, label=u'/usr/bin')
		rb_usrlib = wx.RadioButton(pnl_target, label=u'/usr/lib')
		rb_locbin = wx.RadioButton(pnl_target, label=u'/usr/local/bin')
		rb_loclib = wx.RadioButton(pnl_target, label=u'/usr/local/lib')
		self.rb_custom = wx.RadioButton(pnl_target, inputid.CUSTOM, GT(u'Custom'))
		self.rb_custom.Default = True

		# Start with "Custom" selected
		self.rb_custom.SetValue(self.rb_custom.Default)

		# group buttons together
		# FIXME: Unnecessary???
		self.grp_targets = (
			rb_bin,
			rb_usrbin,
			rb_usrlib,
			rb_locbin,
			rb_loclib,
			self.rb_custom,
			)

		# ----- Add/Remove/Clear buttons
		btn_add = CreateButton(self, btnid.ADD)
		btn_remove = CreateButton(self, btnid.REMOVE)
		btn_clear = CreateButton(self, btnid.CLEAR)

		self.prev_dest_value = u'/usr/bin'
		self.ti_target = TextArea(self, defaultValue=self.prev_dest_value, name=u'target')

		self.btn_browse = CreateButton(self, btnid.BROWSE)
		btn_refresh = CreateButton(self, btnid.REFRESH)

		# Display area for files added to list
		self.lst_files = FileListESS(self, inputid.LIST, name=u'filelist')

		# *** Event Handling *** #

		# create an event to enable/disable custom widget
		for item in self.grp_targets:
			wx.EVT_RADIOBUTTON(item, wx.ID_ANY, self.OnSetDestination)

		# Context menu events for directory tree
		wx.EVT_MENU(self, wx.ID_ADD, self.OnImportFromTree)

		# Button events
		btn_add.Bind(wx.EVT_BUTTON, self.OnImportFromTree)
		btn_remove.Bind(wx.EVT_BUTTON, self.OnRemoveSelected)
		btn_clear.Bind(wx.EVT_BUTTON, self.OnClearFileList)
		self.btn_browse.Bind(wx.EVT_BUTTON, self.OnBrowse)
		btn_refresh.Bind(wx.EVT_BUTTON, self.OnRefreshFileList)

		# ???: Not sure what these do
		wx.EVT_KEY_DOWN(self.ti_target, self.GetDestValue)
		wx.EVT_KEY_UP(self.ti_target, self.CheckDest)

		# Key events for file list
		wx.EVT_KEY_DOWN(self.lst_files, self.OnRemoveSelected)

		self.Bind(wx.EVT_DROP_FILES, self.OnDropFiles)

		# *** Layout *** #

		lyt_treeopts = BoxSizer(wx.VERTICAL)
		lyt_treeopts.AddSpacer(5)
		lyt_treeopts.Add(self.chk_individuals, 0, lyt.PAD_LR, 5)
		lyt_treeopts.Add(self.chk_preserve_top, 0, lyt.PAD_LR, 5)
		lyt_treeopts.AddSpacer(5)

		pnl_treeopts.SetSizer(lyt_treeopts)

		lyt_left = BoxSizer(wx.VERTICAL)
		lyt_left.AddSpacer(10)
		lyt_left.Add(wx.StaticText(self, label=GT(u'Directory options')), 0, wx.ALIGN_BOTTOM)
		lyt_left.Add(pnl_treeopts, 0, wx.EXPAND|wx.ALIGN_LEFT|wx.BOTTOM, 5)
		lyt_left.Add(self.tree_dirs, 1, wx.EXPAND)

		lyt_target = wx.GridSizer(3, 2, 5, 5)

		for item in self.grp_targets:
			lyt_target.Add(item, 0, lyt.PAD_LR, 5)

		pnl_target.SetAutoLayout(True)
		pnl_target.SetSizer(lyt_target)
		pnl_target.Layout()

		# Put text input in its own sizer to force expand
		lyt_input = BoxSizer(wx.HORIZONTAL)
		lyt_input.Add(self.ti_target, 1, wx.ALIGN_CENTER_VERTICAL)

		lyt_buttons = BoxSizer(wx.HORIZONTAL)
		lyt_buttons.Add(btn_add, 0)
		lyt_buttons.Add(btn_remove, 0)
		lyt_buttons.Add(btn_clear, 0)
		lyt_buttons.Add(lyt_input, 1, wx.ALIGN_CENTER_VERTICAL)
		lyt_buttons.Add(self.btn_browse, 0)
		lyt_buttons.Add(btn_refresh, 0)

		lyt_right = BoxSizer(wx.VERTICAL)
		lyt_right.AddSpacer(10)
		lyt_right.Add(wx.StaticText(self, label=GT(u'Target')))
		lyt_right.Add(pnl_target, 0, wx.TOP, 5)
		lyt_right.Add(lyt_buttons, 0, wx.EXPAND)
		lyt_right.Add(self.lst_files, 5, wx.EXPAND|wx.TOP, 5)

		PROP_LEFT = 0
		PROP_RIGHT = 1

		lyt_main = wx.FlexGridSizer(1, 2)
		lyt_main.AddGrowableRow(0)

		# Directory tree size issues with wx 2.8
		if wx.MAJOR_VERSION <= 2:
			PROP_LEFT = 1
			lyt_main.AddGrowableCol(0, 1)

		lyt_main.AddGrowableCol(1, 2)
		lyt_main.Add(lyt_left, PROP_LEFT, wx.EXPAND|lyt.PAD_LR|wx.BOTTOM, 5)
		lyt_main.Add(lyt_right, PROP_RIGHT, wx.EXPAND|lyt.PAD_RB, 5)

		self.SetAutoLayout(True)
		self.SetSizer(lyt_main)
		self.Layout()

		SetPageToolTips(self)
Esempio n. 14
0
    def __init__(self, parent):
        WizardPage.__init__(self, parent, pgid.SCRIPTS)

        preinst = DebianScript(self, ID_INST_PRE)
        postinst = DebianScript(self, ID_INST_POST)
        prerm = DebianScript(self, ID_RM_PRE)
        postrm = DebianScript(self, ID_RM_POST)

        # Check boxes for choosing scripts
        chk_preinst = CheckBox(self,
                               ID_INST_PRE,
                               GT(u'Make this script'),
                               name=GT(u'Pre-Install'))
        preinst.SetCheckBox(chk_preinst)
        chk_postinst = CheckBox(self,
                                ID_INST_POST,
                                GT(u'Make this script'),
                                name=GT(u'Post-Install'))
        postinst.SetCheckBox(chk_postinst)
        chk_prerm = CheckBox(self,
                             ID_RM_PRE,
                             GT(u'Make this script'),
                             name=GT(u'Pre-Remove'))
        prerm.SetCheckBox(chk_prerm)
        chk_postrm = CheckBox(self,
                              ID_RM_POST,
                              GT(u'Make this script'),
                              name=GT(u'Post-Remove'))
        postrm.SetCheckBox(chk_postrm)

        for S in chk_preinst, chk_postinst, chk_prerm, chk_postrm:
            S.SetToolTipString(u'{} {}'.format(
                S.GetName(), GT(u'script will be created from text below')))

            S.Bind(wx.EVT_CHECKBOX, self.OnToggleScripts)

        # Radio buttons for displaying between pre- and post- install scripts
        # FIXME: Names settings for tooltips are confusing
        rb_preinst = wx.RadioButton(self,
                                    preinst.GetId(),
                                    GT(u'Pre-Install'),
                                    name=preinst.FileName,
                                    style=wx.RB_GROUP)
        rb_postinst = wx.RadioButton(self,
                                     postinst.GetId(),
                                     GT(u'Post-Install'),
                                     name=postinst.FileName)
        rb_prerm = wx.RadioButton(self,
                                  prerm.GetId(),
                                  GT(u'Pre-Remove'),
                                  name=prerm.FileName)
        rb_postrm = wx.RadioButton(self,
                                   postrm.GetId(),
                                   GT(u'Post-Remove'),
                                   name=postrm.FileName)

        # TODO: Remove check boxes from lists (no longer needed)
        self.script_objects = (
            (
                preinst,
                chk_preinst,
                rb_preinst,
            ),
            (
                postinst,
                chk_postinst,
                rb_postinst,
            ),
            (
                prerm,
                chk_prerm,
                rb_prerm,
            ),
            (
                postrm,
                chk_postrm,
                rb_postrm,
            ),
        )

        for DS, CHK, RB in self.script_objects:
            CHK.Hide()

        # Set script text areas to default enabled/disabled setting
        self.OnToggleScripts()

        # *** Auto-Link *** #

        pnl_autolink = BorderedPanel(self)

        # Auto-Link path for new link
        txt_autolink = wx.StaticText(pnl_autolink,
                                     label=GT(u'Path'),
                                     name=u'target')
        self.ti_autolink = PathCtrl(pnl_autolink,
                                    value=u'/usr/bin',
                                    defaultValue=u'/usr/bin',
                                    warn=True)
        self.ti_autolink.SetName(u'target')
        self.ti_autolink.Default = self.ti_autolink.GetValue()

        # Auto-Link executables to be linked
        self.Executables = BasicFileList(pnl_autolink,
                                         size=(200, 200),
                                         hlExe=True,
                                         name=u'al list')

        # Auto-Link import, generate and remove buttons
        btn_al_import = CreateButton(pnl_autolink, btnid.IMPORT)
        btn_al_remove = CreateButton(pnl_autolink, btnid.REMOVE)
        btn_al_generate = CreateButton(pnl_autolink, image=u'build')

        # Auto-Link help
        btn_help = CreateButton(pnl_autolink, btnid.HELP, size=64)

        # Initialize script display
        self.ScriptSelect(None)

        SetPageToolTips(self)

        # *** Event Handling *** #

        for DS, CHK, RB in self.script_objects:
            RB.Bind(wx.EVT_RADIOBUTTON, self.ScriptSelect)

        wx.EVT_BUTTON(btn_al_import, btnid.IMPORT, self.ImportExes)
        wx.EVT_BUTTON(btn_al_generate, wx.ID_ANY, self.OnGenerate)
        wx.EVT_BUTTON(btn_al_remove, btnid.REMOVE, self.ImportExes)
        wx.EVT_BUTTON(btn_help, btnid.HELP, self.OnHelpButton)

        # *** Layout *** #

        # Organizing radio buttons
        lyt_sel_script = BoxSizer(wx.HORIZONTAL)
        lyt_sel_script.AddMany((
            (chk_preinst),
            (chk_postinst),
            (chk_prerm),
            (chk_postrm),
        ))

        lyt_sel_script.AddStretchSpacer(1)

        lyt_sel_script.AddMany((
            (rb_preinst),
            (rb_postinst),
            (rb_prerm),
            (rb_postrm),
        ))

        # Sizer for left half of scripts panel
        lyt_left = BoxSizer(wx.VERTICAL)
        lyt_left.Add(lyt_sel_script, 0, wx.EXPAND | wx.BOTTOM, 5)

        for DS, CHK, RB, in self.script_objects:
            lyt_left.Add(DS, 1, wx.EXPAND)

        # Auto-Link/Right side
        lyt_ti_autolink = BoxSizer(wx.HORIZONTAL)
        lyt_ti_autolink.Add(txt_autolink, 0, lyt.ALGN_C)
        lyt_ti_autolink.Add(self.ti_autolink, 1, lyt.ALGN_C)

        lyt_btn_autolink = BoxSizer(wx.HORIZONTAL)
        lyt_btn_autolink.Add(btn_al_import, 0)
        lyt_btn_autolink.Add(btn_al_remove, 0, lyt.PAD_LR, 5)
        lyt_btn_autolink.Add(btn_al_generate, 0)

        lyt_autolink = BoxSizer(wx.VERTICAL)
        lyt_autolink.Add(lyt_ti_autolink, 0, wx.EXPAND | lyt.PAD_LRT, 5)
        lyt_autolink.Add(self.Executables, 3, wx.EXPAND | lyt.PAD_LRT, 5)
        lyt_autolink.Add(lyt_btn_autolink, 0, lyt.ALGN_CH)
        lyt_autolink.Add(btn_help, 1, lyt.ALGN_C)

        pnl_autolink.SetSizer(lyt_autolink)
        pnl_autolink.SetAutoLayout(True)
        pnl_autolink.Layout()

        # Sizer for right half of scripts panel
        lyt_right = BoxSizer(wx.VERTICAL)
        # Line up panels to look even
        lyt_right.AddSpacer(32)
        lyt_right.Add(wx.StaticText(self, label=GT(u'Auto-Link Executables')),
                      0, lyt.ALGN_LB)
        lyt_right.Add(pnl_autolink, 0, wx.EXPAND)

        lyt_main = BoxSizer(wx.HORIZONTAL)
        lyt_main.Add(lyt_left, 1, wx.EXPAND | wx.ALL, 5)
        lyt_main.Add(lyt_right, 0, lyt.PAD_RB, 5)

        self.SetAutoLayout(True)
        self.SetSizer(lyt_main)
        self.Layout()
Esempio n. 15
0
    def __init__(self, parent):
        WizardPage.__init__(self, parent, pgid.CHANGELOG)

        txt_package = wx.StaticText(self,
                                    label=GT(u'Package'),
                                    name=u'package')
        self.ti_package = TextArea(self,
                                   inputid.PACKAGE,
                                   name=txt_package.Name)

        txt_version = wx.StaticText(self,
                                    label=GT(u'Version'),
                                    name=u'version')
        self.ti_version = TextArea(self,
                                   inputid.VERSION,
                                   name=txt_version.Name)

        dist_names = GetOSDistNames()

        txt_dist = wx.StaticText(self, label=GT(u'Distribution'), name=u'dist')

        if dist_names:
            self.ti_dist = ComboBox(self,
                                    inputid.DIST,
                                    choices=dist_names,
                                    name=txt_dist.Name)

        # Use regular text input if could not retrieve distribution names list
        else:
            self.ti_dist = TextArea(self, inputid.DIST, name=txt_dist.Name)

        opts_urgency = (
            u'low',
            u'medium',
            u'high',
            u'emergency',
        )

        txt_urgency = wx.StaticText(self,
                                    label=GT(u'Urgency'),
                                    name=u'urgency')
        self.sel_urgency = Choice(self,
                                  selid.URGENCY,
                                  choices=opts_urgency,
                                  name=txt_urgency.Name)

        txt_maintainer = wx.StaticText(self,
                                       label=GT(u'Maintainer'),
                                       name=u'maintainer')
        self.ti_maintainer = TextArea(self,
                                      inputid.MAINTAINER,
                                      name=txt_maintainer.Name)

        txt_email = wx.StaticText(self, label=GT(u'Email'), name=u'email')
        self.ti_email = TextArea(self, inputid.EMAIL, name=txt_email.Name)

        btn_import = CreateButton(self,
                                  btnid.IMPORT,
                                  GT(u'Import'),
                                  u'import',
                                  name=u'btn import')
        txt_import = wx.StaticText(
            self, label=GT(u'Import information from Control page'))

        # Changes input
        self.ti_changes = TextAreaPanel(self, size=(20, 150), name=u'changes')

        # *** Target installation directory

        # FIXME: Should this be set by config or project file???
        self.pnl_target = FileOTarget(self,
                                      u'/usr/share/doc/<package>',
                                      name=u'target default',
                                      defaultType=CheckBoxESS,
                                      customType=PathCtrlESS,
                                      pathIds=(
                                          chkid.TARGET,
                                          inputid.TARGET,
                                      ))

        self.btn_add = CreateButton(self,
                                    btnid.ADD,
                                    GT(u'Add'),
                                    u'add',
                                    name=u'btn add')
        txt_add = wx.StaticText(self, label=GT(u'Insert new changelog entry'))

        self.chk_indentation = CheckBox(self,
                                        label=GT(u'Preserve indentation'),
                                        name=u'indent')

        self.dsp_changes = TextAreaPanelESS(self,
                                            inputid.CHANGES,
                                            monospace=True,
                                            name=u'log')
        self.dsp_changes.EnableDropTarget()

        SetPageToolTips(self)

        # *** Event Handling *** #

        btn_import.Bind(wx.EVT_BUTTON, self.OnImportFromControl)
        self.btn_add.Bind(wx.EVT_BUTTON, self.AddInfo)

        # *** Layout *** #

        LEFT_BOTTOM = lyt.ALGN_LB
        LEFT_CENTER = wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL
        RIGHT_CENTER = wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL

        lyt_info = wx.FlexGridSizer(2, 6)

        lyt_info.AddGrowableCol(1)
        lyt_info.AddGrowableCol(3)
        lyt_info.AddGrowableCol(5)
        lyt_info.AddMany(
            ((txt_package, 0, RIGHT_CENTER | wx.RIGHT,
              5), (self.ti_package, 1, wx.EXPAND | wx.BOTTOM | wx.RIGHT,
                   5), (txt_version, 0, RIGHT_CENTER | wx.RIGHT, 5),
             (self.ti_version, 1, wx.EXPAND | wx.BOTTOM | wx.RIGHT,
              5), (txt_dist, 0, RIGHT_CENTER | wx.RIGHT,
                   5), (self.ti_dist, 1, wx.EXPAND | wx.BOTTOM,
                        5), (txt_urgency, 0, RIGHT_CENTER | wx.RIGHT,
                             5), (self.sel_urgency, 1, wx.RIGHT, 5),
             (txt_maintainer, 0, RIGHT_CENTER | wx.RIGHT,
              5), (self.ti_maintainer, 1, wx.EXPAND | wx.RIGHT,
                   5), (txt_email, 0, RIGHT_CENTER | wx.RIGHT,
                        5), (self.ti_email, 1, wx.EXPAND)))

        lyt_details = wx.GridBagSizer()
        lyt_details.SetCols(3)
        lyt_details.AddGrowableRow(2)
        lyt_details.AddGrowableCol(1)

        lyt_details.Add(btn_import, (0, 0))
        lyt_details.Add(txt_import, (0, 1), flag=LEFT_CENTER)
        lyt_details.Add(wx.StaticText(self, label=GT(u'Changes')), (1, 0),
                        flag=LEFT_BOTTOM)
        lyt_details.Add(wx.StaticText(self, label=GT(u'Target')), (1, 2),
                        flag=LEFT_BOTTOM)
        lyt_details.Add(self.ti_changes, (2, 0), (1, 2), wx.EXPAND | wx.RIGHT,
                        5)
        lyt_details.Add(self.pnl_target, (2, 2))
        lyt_details.Add(self.btn_add, (3, 0), (2, 1))
        lyt_details.Add(txt_add, (3, 1), flag=LEFT_BOTTOM | wx.TOP, border=5)
        lyt_details.Add(self.chk_indentation, (4, 1), flag=LEFT_BOTTOM)

        lyt_main = BoxSizer(wx.VERTICAL)
        lyt_main.AddSpacer(10)
        lyt_main.Add(lyt_info, 0, wx.EXPAND | lyt.PAD_LR, 5)
        lyt_main.AddSpacer(10)
        lyt_main.Add(lyt_details, 1, wx.EXPAND | lyt.PAD_LR, 5)
        lyt_main.Add(wx.StaticText(self, label=u'Changelog Output'), 0,
                     LEFT_BOTTOM | lyt.PAD_LT, 5)
        lyt_main.Add(self.dsp_changes, 1, wx.EXPAND | lyt.PAD_LR | wx.BOTTOM,
                     5)

        self.SetAutoLayout(True)
        self.SetSizer(lyt_main)
        self.Layout()
Esempio n. 16
0
	def __init__(self, parent):
		WizardPage.__init__(self, parent, pgid.DEPENDS)

		## Override default label
		self.Label = GT(u'Dependencies and Conflicts')

		# Bypass checking this page for build
		self.prebuild_check = False

		# Buttons to open, save, & preview control file
		self.btn_open = CreateButton(self, btnid.BROWSE, GT(u'Browse'), u'browse', name=u'btn browse')
		self.btn_save = CreateButton(self, btnid.SAVE, GT(u'Save'), u'save', name=u'btn save')
		self.btn_preview = CreateButton(self, btnid.PREVIEW, GT(u'Preview'), u'preview', name=u'btn preview')

		txt_package = wx.StaticText(self, label=GT(u'Dependency/Conflict Package Name'), name=u'package')
		txt_version = wx.StaticText(self, label=GT(u'Version'), name=u'version')

		self.ti_package = TextArea(self, size=(300,25), name=u'package')

		opts_operator = (
			u'>=',
			u'<=',
			u'=',
			u'>>',
			u'<<',
			)

		self.sel_operator = Choice(self, choices=opts_operator, name=u'operator')

		self.ti_version = TextArea(self, name=u'version')

		self.ti_package.SetSize((100,50))

		pnl_categories = BorderedPanel(self)

		self.DefaultCategory = u'Depends'

		rb_dep = wx.RadioButton(pnl_categories, label=GT(u'Depends'), name=self.DefaultCategory, style=wx.RB_GROUP)
		rb_pre = wx.RadioButton(pnl_categories, label=GT(u'Pre-Depends'), name=u'Pre-Depends')
		rb_rec = wx.RadioButton(pnl_categories, label=GT(u'Recommends'), name=u'Recommends')
		rb_sug = wx.RadioButton(pnl_categories, label=GT(u'Suggests'), name=u'Suggests')
		rb_enh = wx.RadioButton(pnl_categories, label=GT(u'Enhances'), name=u'Enhances')
		rb_con = wx.RadioButton(pnl_categories, label=GT(u'Conflicts'), name=u'Conflicts')
		rb_rep = wx.RadioButton(pnl_categories, label=GT(u'Replaces'), name=u'Replaces')
		rb_break = wx.RadioButton(pnl_categories, label=GT(u'Breaks'), name=u'Breaks')

		self.categories = (
			rb_dep, rb_pre, rb_rec,
			rb_sug, rb_enh, rb_con,
			rb_rep, rb_break,
		)

		# Buttons to add and remove dependencies from the list
		btn_add = CreateButton(self, btnid.ADD)
		btn_append = CreateButton(self, btnid.APPEND)
		btn_remove = CreateButton(self, btnid.REMOVE)
		btn_clear = CreateButton(self, btnid.CLEAR)

		# ----- List
		self.lst_deps = ListCtrlESS(self, inputid.LIST, name=u'list')
		self.lst_deps.SetSingleStyle(wx.LC_REPORT)
		self.lst_deps.InsertColumn(0, GT(u'Category'), width=150)
		self.lst_deps.InsertColumn(1, GT(u'Package(s)'))

		# wx 3.0 compatibility
		if wx.MAJOR_VERSION < 3:
			self.lst_deps.SetColumnWidth(100, wx.LIST_AUTOSIZE)

		SetPageToolTips(self)

		# *** Event Handling *** #

		wx.EVT_KEY_DOWN(self.ti_package, self.SetDepends)
		wx.EVT_KEY_DOWN(self.ti_version, self.SetDepends)

		btn_add.Bind(wx.EVT_BUTTON, self.SetDepends)
		btn_append.Bind(wx.EVT_BUTTON, self.SetDepends)
		btn_remove.Bind(wx.EVT_BUTTON, self.SetDepends)
		btn_clear.Bind(wx.EVT_BUTTON, self.SetDepends)

		wx.EVT_KEY_DOWN(self.lst_deps, self.SetDepends)

		# *** Layout *** #

		LEFT_BOTTOM = lyt.ALGN_LB

		lyt_top = wx.GridBagSizer()
		lyt_top.SetCols(6)
		lyt_top.AddGrowableCol(3)

		# Row 1
		lyt_top.Add(txt_package, (1, 0), flag=LEFT_BOTTOM)
		lyt_top.Add(txt_version, (1, 2), flag=LEFT_BOTTOM)
		lyt_top.Add(self.btn_open, (0, 3), (4, 1), wx.ALIGN_RIGHT)
		lyt_top.Add(self.btn_save, (0, 4), (4, 1))
		lyt_top.Add(self.btn_preview, (0, 5), (4, 1))

		# Row 2
		lyt_top.Add(self.ti_package, (2, 0), flag=wx.ALIGN_CENTER_VERTICAL)
		lyt_top.Add(self.sel_operator, (2, 1), flag=wx.ALIGN_CENTER_VERTICAL)
		lyt_top.Add(self.ti_version, (2, 2), flag=wx.ALIGN_CENTER_VERTICAL)

		lyt_categories = wx.GridSizer(4, 2, 5, 5)

		for C in self.categories:
			lyt_categories.Add(C, 0)

		pnl_categories.SetAutoLayout(True)
		pnl_categories.SetSizer(lyt_categories)
		pnl_categories.Layout()

		lyt_buttons = BoxSizer(wx.HORIZONTAL)

		lyt_buttons.AddMany((
			(btn_add, 0, wx.ALIGN_CENTER_VERTICAL),
			(btn_append, 0, wx.ALIGN_CENTER_VERTICAL),
			(btn_remove, 0, wx.ALIGN_CENTER_VERTICAL),
			(btn_clear, 0, wx.ALIGN_CENTER_VERTICAL),
			))

		lyt_mid = wx.GridBagSizer()
		lyt_mid.SetCols(2)

		lyt_mid.Add(wx.StaticText(self, label=u'Categories'), (0, 0), (1, 1), LEFT_BOTTOM)
		lyt_mid.Add(pnl_categories, (1, 0), flag=wx.RIGHT, border=5)
		lyt_mid.Add(lyt_buttons, (1, 1), flag=wx.ALIGN_BOTTOM)

		lyt_list = BoxSizer(wx.HORIZONTAL)
		lyt_list.Add(self.lst_deps, 1, wx.EXPAND)

		lyt_main = BoxSizer(wx.VERTICAL)
		# Spacer is less on this page because text is aligned to bottom
		lyt_main.AddSpacer(5)
		lyt_main.Add(lyt_top, 0, wx.EXPAND|lyt.PAD_LR, 5)
		lyt_main.Add(lyt_mid, 0, lyt.PAD_LR, 5)
		lyt_main.Add(lyt_list, 1, wx.EXPAND|wx.ALL, 5)

		self.SetAutoLayout(True)
		self.SetSizer(lyt_main)
		self.Layout()
Esempio n. 17
0
	def __init__(self, parent):
		WizardPage.__init__(self, parent, pgid.COPYRIGHT)

		self.custom_licenses = []

		## A list of available license templates
		self.sel_templates = Choice(self, selid.LICENSE, name=u'list»')

		# Initialize the template list
		self.OnRefreshList()

		btn_template = CreateButton(self, label=GT(u'Full Template'), image=u'full', name=u'full»')
		self.btn_template_simple = CreateButton(self, label=GT(u'Short Template'), image=u'short',
				name=u'short»')
		btn_refresh = CreateButton(self, btnid.REFRESH, GT(u'Refresh Template List'), u'refresh',
				name=u'btn refresh')
		btn_open = CreateButton(self, btnid.BROWSE, GT(u'Open Template Directory'), u'browse',
				name=u'btn opendir', commands=u'xdg-open')

		if not self.sel_templates.GetCount():
			self.sel_templates.Enable(False)
			btn_template.Enable(False)
			self.btn_template_simple.Enable(False)

		## Area where license text is displayed
		self.dsp_copyright = TextAreaPanelESS(self, monospace=True, name=u'license')
		self.dsp_copyright.EnableDropTarget()

		SetPageToolTips(self)

		# Initiate tooltip for drop-down selector
		if self.sel_templates.IsEnabled():
			self.OnSelectLicense(self.sel_templates)

		# *** Event Handling *** #

		self.sel_templates.Bind(wx.EVT_CHOICE, self.OnSelectLicense)

		btn_open.Bind(wx.EVT_BUTTON, self.OnOpenPath)
		btn_refresh.Bind(wx.EVT_BUTTON, self.OnRefreshList)
		btn_template.Bind(wx.EVT_BUTTON, self.OnTemplateFull)
		self.btn_template_simple.Bind(wx.EVT_BUTTON, self.OnTemplateShort)

		# *** Layout *** #

		lyt_top = BoxSizer(wx.HORIZONTAL)
		lyt_top.Add(wx.StaticText(self, label=GT(u'Available Templates')), 0,
				lyt.ALGN_CV)
		lyt_top.Add(self.sel_templates, 0, lyt.ALGN_CV|wx.LEFT, 5)
		lyt_top.Add(btn_template, 0, wx.LEFT, 5)
		lyt_top.Add(self.btn_template_simple)
		lyt_top.Add(btn_refresh)
		lyt_top.Add(btn_open)

		lyt_main = BoxSizer(wx.VERTICAL)
		lyt_main.AddSpacer(10)
		lyt_main.Add(lyt_top, 0, lyt.PAD_LR|wx.BOTTOM, 5)
		lyt_main.Add(self.dsp_copyright, 1, wx.EXPAND|lyt.PAD_LRB, 5)

		self.SetAutoLayout(True)
		self.SetSizer(lyt_main)
		self.Layout()
Esempio n. 18
0
	def __init__(self, parent):
		WizardPage.__init__(self, parent, pgid.BUILD)

		# Bypass build prep check
		self.prebuild_check = False

		# Add checkable items to this list
		# FIXME: Use a different method
		self.build_options = []

		# ----- Extra Options

		pnl_options = BorderedPanel(self)

		self.chk_md5 = CheckBoxESS(pnl_options, chkid.MD5, GT(u'Create md5sums file'),
				name=u'MD5', defaultValue=True, commands=u'md5sum')
		# The » character denotes that an alternate tooltip should be shown if the control is disabled
		self.chk_md5.tt_name = u'md5»'
		self.chk_md5.col = 0

		if UsingTest(u'alpha'):
			# Brings up control file preview for editing
			self.chk_editctrl = CheckBoxCFG(pnl_options, chkid.EDIT, GT(u'Preview control file for editing'),
					name=u'editctrl')
			self.chk_editctrl.col = 1

		# TODO: Use CheckBoxCFG instead of CheckBoxESS:
		#		   Fields will be set from config instead of project file

		# Option to strip binaries
		self.chk_strip = CheckBoxESS(pnl_options, chkid.STRIP, GT(u'Strip binaries'),
				name=u'strip»', defaultValue=True, commands=u'strip')
		self.chk_strip.col = 0

		# Deletes the temporary build tree
		self.chk_rmstage = CheckBoxESS(pnl_options, chkid.DELETE, GT(u'Delete staged directory'),
				name=u'RMSTAGE', defaultValue=True)
		self.chk_rmstage.col = 0

		# Checks the output .deb for errors
		self.chk_lint = CheckBoxESS(pnl_options, chkid.LINT, GT(u'Check package for errors with lintian'),
				name=u'LINTIAN', defaultValue=True, commands=u'lintian')
		self.chk_lint.tt_name = u'lintian»'
		self.chk_lint.col = 0

		# Installs the deb on the system
		self.chk_install = CheckBox(pnl_options, chkid.INSTALL, GT(u'Install package after build'),
				name=u'INSTALL', commands=(u'gdebi-gtk', u'gdebi-kde',))
		self.chk_install.tt_name = u'install»'
		self.chk_install.col = 0

		# *** Lintian Overrides *** #

		if UsingTest(u'alpha'):
			# FIXME: Move next to lintian check box
			self.lint_overrides = []
			btn_lint_overrides = CreateButton(self, label=GT(u'Lintian overrides'))
			btn_lint_overrides.Bind(wx.EVT_BUTTON, self.OnSetLintOverrides)

		btn_build = CreateButton(self, btnid.BUILD, GT(u'Build'), u'build', 64)

		# Display log
		dsp_log = OutputLog(self)

		SetPageToolTips(self)

		# *** Event Handling *** #

		btn_build.Bind(wx.EVT_BUTTON, self.OnBuild)

		# *** Layout *** #

		lyt_options = wx.GridBagSizer()

		next_row = 0
		prev_row = next_row
		for CHK in pnl_options.Children:
			row = next_row
			FLAGS = lyt.PAD_LR

			if CHK.col:
				row = prev_row
				FLAGS = wx.RIGHT

			lyt_options.Add(CHK, (row, CHK.col), flag=FLAGS, border=5)

			if not CHK.col:
				prev_row = next_row
				next_row += 1

		pnl_options.SetSizer(lyt_options)
		pnl_options.SetAutoLayout(True)
		pnl_options.Layout()

		lyt_buttons = BoxSizer(wx.HORIZONTAL)
		lyt_buttons.Add(btn_build, 1)

		lyt_main = BoxSizer(wx.VERTICAL)
		lyt_main.AddSpacer(10)
		lyt_main.Add(wx.StaticText(self, label=GT(u'Extra Options')), 0,
				lyt.ALGN_LB|wx.LEFT, 5)
		lyt_main.Add(pnl_options, 0, wx.LEFT, 5)
		lyt_main.AddSpacer(5)

		if UsingTest(u'alpha'):
			#lyt_main.Add(wx.StaticText(self, label=GT(u'Lintian overrides')), 0, wx.LEFT, 5)
			lyt_main.Add(btn_lint_overrides, 0, wx.LEFT, 5)

		lyt_main.AddSpacer(5)
		lyt_main.Add(lyt_buttons, 0, lyt.ALGN_C)
		lyt_main.Add(dsp_log, 2, wx.EXPAND|lyt.PAD_LRB, 5)

		self.SetAutoLayout(True)
		self.SetSizer(lyt_main)
		self.Layout()

		# *** Post-layout functions *** #

		self.InitDefaultSettings()
Esempio n. 19
0
    def __init__(self, parent):
        WizardPage.__init__(self, parent, pgid.CONTROL)

        # Bypass checking this page for build
        # This is mandatory & done manually
        self.prebuild_check = False

        self.SetScrollbars(0, 20, 0, 0)

        pnl_bg = wx.Panel(self)

        # Buttons to open, save, & preview control file
        btn_open = CreateButton(pnl_bg,
                                btnid.BROWSE,
                                GT(u'Browse'),
                                u'browse',
                                name=u'btn browse')
        btn_save = CreateButton(pnl_bg,
                                btnid.SAVE,
                                GT(u'Save'),
                                u'save',
                                name=u'btn save')
        btn_preview = CreateButton(pnl_bg,
                                   btnid.PREVIEW,
                                   GT(u'Preview'),
                                   u'preview',
                                   name=u'btn preview')

        # *** Required fields *** #

        pnl_require = BorderedPanel(pnl_bg)

        txt_package = wx.StaticText(pnl_require,
                                    label=GT(u'Package'),
                                    name=u'package')
        txt_package.req = True
        ti_package = TextAreaESS(pnl_require,
                                 inputid.PACKAGE,
                                 name=txt_package.Name)
        ti_package.req = True

        txt_version = wx.StaticText(pnl_require,
                                    label=GT(u'Version'),
                                    name=u'version')
        txt_version.req = True
        ti_version = TextAreaESS(pnl_require,
                                 inputid.VERSION,
                                 name=txt_version.Name)
        ti_version.req = True

        txt_maintainer = wx.StaticText(pnl_require,
                                       label=GT(u'Maintainer'),
                                       name=u'maintainer')
        txt_maintainer.req = True
        ti_maintainer = TextAreaESS(pnl_require,
                                    inputid.MAINTAINER,
                                    name=txt_maintainer.Name)
        ti_maintainer.req = True

        txt_email = wx.StaticText(pnl_require,
                                  label=GT(u'Email'),
                                  name=u'email')
        txt_email.req = True
        ti_email = TextAreaESS(pnl_require, inputid.EMAIL, name=txt_email.Name)
        ti_email.req = True

        opts_arch = (
            u'all',
            u'alpha',
            u'amd64',
            u'arm',
            u'arm64',
            u'armeb',
            u'armel',
            u'armhf',
            u'avr32',
            u'hppa',
            u'i386',
            u'ia64',
            u'lpia',
            u'm32r',
            u'm68k',
            u'mips',
            u'mipsel',
            u'powerpc',
            u'powerpcspe',
            u'ppc64',
            u's390',
            u's390x',
            u'sh3',
            u'sh3eb',
            u'sh4',
            u'sh4eb',
            u'sparc',
            u'sparc64',
        )

        txt_arch = wx.StaticText(pnl_require,
                                 label=GT(u'Architecture'),
                                 name=u'architecture')
        sel_arch = ChoiceESS(pnl_require,
                             inputid.ARCH,
                             choices=opts_arch,
                             name=txt_arch.Name)
        sel_arch.Default = 0
        sel_arch.SetSelection(sel_arch.Default)

        # *** Recommended fields *** #

        pnl_recommend = BorderedPanel(pnl_bg)

        opts_section = (
            u'admin',
            u'cli-mono',
            u'comm',
            u'database',
            u'devel',
            u'debug',
            u'doc',
            u'editors',
            u'electronics',
            u'embedded',
            u'fonts',
            u'games',
            u'gnome',
            u'graphics',
            u'gnu-r',
            u'gnustep',
            u'hamradio',
            u'haskell',
            u'httpd',
            u'interpreters',
            u'java',
            u'kde',
            u'kernel',
            u'libs',
            u'libdevel',
            u'lisp',
            u'localization',
            u'mail',
            u'math',
            u'metapackages',
            u'misc',
            u'net',
            u'news',
            u'ocaml',
            u'oldlibs',
            u'otherosfs',
            u'perl',
            u'php',
            u'python',
            u'ruby',
            u'science',
            u'shells',
            u'sound',
            u'tex',
            u'text',
            u'utils',
            u'vcs',
            u'video',
            u'web',
            u'x11',
            u'xfce',
            u'zope',
        )

        txt_section = wx.StaticText(pnl_recommend,
                                    label=GT(u'Section'),
                                    name=u'section')
        ti_section = ComboBoxESS(pnl_recommend,
                                 choices=opts_section,
                                 name=txt_section.Name)

        opts_priority = (
            u'optional',
            u'standard',
            u'important',
            u'required',
            u'extra',
        )

        txt_priority = wx.StaticText(pnl_recommend,
                                     label=GT(u'Priority'),
                                     name=u'priority')
        sel_priority = ChoiceESS(pnl_recommend,
                                 choices=opts_priority,
                                 name=txt_priority.Name)
        sel_priority.Default = 0
        sel_priority.SetSelection(sel_priority.Default)

        txt_synopsis = wx.StaticText(pnl_recommend,
                                     label=GT(u'Short Description'),
                                     name=u'synopsis')
        ti_synopsis = TextAreaESS(pnl_recommend, name=txt_synopsis.Name)

        txt_description = wx.StaticText(pnl_recommend,
                                        label=GT(u'Long Description'),
                                        name=u'description')
        self.ti_description = TextAreaPanelESS(pnl_recommend,
                                               name=txt_description.Name)

        # *** Optional fields *** #

        pnl_option = BorderedPanel(pnl_bg)

        txt_source = wx.StaticText(pnl_option,
                                   label=GT(u'Source'),
                                   name=u'source')
        ti_source = TextAreaESS(pnl_option, name=txt_source.Name)

        txt_homepage = wx.StaticText(pnl_option,
                                     label=GT(u'Homepage'),
                                     name=u'homepage')
        ti_homepage = TextAreaESS(pnl_option, name=txt_homepage.Name)

        txt_essential = wx.StaticText(pnl_option,
                                      label=GT(u'Essential'),
                                      name=u'essential')
        self.chk_essential = CheckBoxESS(pnl_option, name=u'essential')
        self.chk_essential.Default = False

        self.grp_input = (
            ti_package,
            ti_version,
            ti_maintainer,  # Maintainer must be listed before email
            ti_email,
            ti_section,
            ti_source,
            ti_homepage,
            ti_synopsis,
            self.ti_description,
        )

        self.grp_select = (
            sel_arch,
            sel_priority,
        )

        SetPageToolTips(self)

        # *** Event Handling *** #

        btn_open.Bind(wx.EVT_BUTTON, self.OnBrowse)
        btn_save.Bind(wx.EVT_BUTTON, self.OnSave)
        btn_preview.Bind(wx.EVT_BUTTON, self.OnPreviewControl)

        # *** Layout *** #

        LEFT_BOTTOM = lyt.ALGN_LB
        RIGHT_CENTER = wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT

        # Buttons
        lyt_buttons = BoxSizer(wx.HORIZONTAL)
        lyt_buttons.Add(btn_open, 0)
        lyt_buttons.Add(btn_save, 0)
        lyt_buttons.Add(btn_preview, 0)

        # Required fields
        lyt_require = wx.FlexGridSizer(0, 4, 5, 5)
        lyt_require.AddGrowableCol(1)
        lyt_require.AddGrowableCol(3)

        lyt_require.AddMany((
            (txt_package, 0, RIGHT_CENTER | lyt.PAD_LT, 5),
            (ti_package, 0, wx.EXPAND | wx.TOP, 5),
            (txt_version, 0, RIGHT_CENTER | wx.TOP, 5),
            (ti_version, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 5),
            (txt_maintainer, 0, RIGHT_CENTER | wx.LEFT, 5),
            (ti_maintainer, 0, wx.EXPAND),
            (txt_email, 0, RIGHT_CENTER, 5),
            (ti_email, 0, wx.EXPAND | wx.RIGHT, 5),
            (txt_arch, 0, RIGHT_CENTER | lyt.PAD_LB, 5),
            (sel_arch, 0, wx.BOTTOM, 5),
        ))

        pnl_require.SetSizer(lyt_require)
        pnl_require.SetAutoLayout(True)
        pnl_require.Layout()

        # Recommended fields
        lyt_recommend = wx.GridBagSizer()
        lyt_recommend.SetCols(4)
        lyt_recommend.AddGrowableCol(1)
        lyt_recommend.AddGrowableRow(3)

        lyt_recommend.Add(txt_section, (0, 2),
                          flag=RIGHT_CENTER | lyt.PAD_TB,
                          border=5)
        lyt_recommend.Add(ti_section, (0, 3),
                          flag=wx.EXPAND | lyt.PAD_RTB,
                          border=5)
        lyt_recommend.Add(txt_synopsis, (0, 0), (1, 2), LEFT_BOTTOM | wx.LEFT,
                          5)
        lyt_recommend.Add(ti_synopsis, (1, 0), (1, 2), wx.EXPAND | lyt.PAD_LR,
                          5)
        lyt_recommend.Add(txt_priority, (1, 2), flag=RIGHT_CENTER, border=5)
        lyt_recommend.Add(sel_priority, (1, 3),
                          flag=wx.EXPAND | wx.RIGHT,
                          border=5)
        lyt_recommend.Add(txt_description, (2, 0), (1, 2),
                          LEFT_BOTTOM | lyt.PAD_LT, 5)
        lyt_recommend.Add(self.ti_description, (3, 0), (1, 4),
                          wx.EXPAND | lyt.PAD_LR | wx.BOTTOM, 5)

        pnl_recommend.SetSizer(lyt_recommend)
        pnl_recommend.SetAutoLayout(True)
        pnl_recommend.Layout()

        # Optional fields
        lyt_option = wx.FlexGridSizer(0, 4, 5, 5)

        lyt_option.AddGrowableCol(1)
        lyt_option.AddGrowableCol(3)
        lyt_option.AddSpacer(5)
        lyt_option.AddSpacer(5)
        lyt_option.AddSpacer(5)
        lyt_option.AddSpacer(5)
        lyt_option.AddMany((
            (txt_source, 0, RIGHT_CENTER | wx.LEFT, 5),
            (ti_source, 0, wx.EXPAND),
            (txt_homepage, 0, RIGHT_CENTER, 5),
            (ti_homepage, 0, wx.EXPAND | wx.RIGHT, 5),
            (txt_essential, 0, RIGHT_CENTER | lyt.PAD_LB, 5),
            (self.chk_essential, 0, wx.BOTTOM, 5),
        ))

        pnl_option.SetSizer(lyt_option)
        pnl_option.SetAutoLayout(True)
        pnl_option.Layout()

        # Main background panel sizer
        # FIXME: Is background panel (pnl_bg) necessary
        lyt_bg = BoxSizer(wx.VERTICAL)
        lyt_bg.Add(lyt_buttons, 0, wx.ALIGN_RIGHT | wx.BOTTOM, 5)
        lyt_bg.Add(wx.StaticText(pnl_bg, label=GT(u'Required')), 0)
        lyt_bg.Add(pnl_require, 0, wx.EXPAND)
        lyt_bg.Add(wx.StaticText(pnl_bg, label=GT(u'Recommended')), 0, wx.TOP,
                   5)
        lyt_bg.Add(pnl_recommend, 1, wx.EXPAND)
        lyt_bg.Add(wx.StaticText(pnl_bg, label=GT(u'Optional')), 0, wx.TOP, 5)
        lyt_bg.Add(pnl_option, 0, wx.EXPAND)

        pnl_bg.SetAutoLayout(True)
        pnl_bg.SetSizer(lyt_bg)
        pnl_bg.Layout()

        # Page's main sizer
        lyt_main = BoxSizer(wx.VERTICAL)
        lyt_main.AddSpacer(5)
        lyt_main.Add(pnl_bg, 1, wx.EXPAND | lyt.PAD_LR | wx.BOTTOM, 5)

        self.SetAutoLayout(True)
        self.SetSizer(lyt_main)
        self.Layout()
Esempio n. 20
0
 def __init__(self, parent):
     WizardPage.__init__(self, parent, pgid.COPYRIGHT)
     
     self.custom_licenses = []
     
     ## A list of available license templates
     self.sel_templates = Choice(self, selid.LICENSE, name=u'list»')
     
     # Initialize the template list
     self.OnRefreshList()
     
     btn_template = CreateButton(self, label=GT(u'Full Template'), image=u'full', name=u'full»')
     self.btn_template_simple = CreateButton(self, label=GT(u'Short Template'), image=u'short',
             name=u'short»')
     btn_refresh = CreateButton(self, btnid.REFRESH, GT(u'Refresh Template List'), u'refresh',
             name=u'btn refresh')
     btn_open = CreateButton(self, btnid.BROWSE, GT(u'Open Template Directory'), u'browse',
             name=u'btn opendir', commands=u'xdg-open')
     
     if not self.sel_templates.GetCount():
         self.sel_templates.Enable(False)
         btn_template.Enable(False)
         self.btn_template_simple.Enable(False)
     
     ## Area where license text is displayed
     self.dsp_copyright = TextAreaPanelESS(self, monospace=True, name=u'license')
     self.dsp_copyright.EnableDropTarget()
     
     SetPageToolTips(self)
     
     # Initiate tooltip for drop-down selector
     if self.sel_templates.IsEnabled():
         self.OnSelectLicense(self.sel_templates)
     
     # *** Event Handling *** #
     
     self.sel_templates.Bind(wx.EVT_CHOICE, self.OnSelectLicense)
     
     btn_open.Bind(wx.EVT_BUTTON, self.OnOpenPath)
     btn_refresh.Bind(wx.EVT_BUTTON, self.OnRefreshList)
     btn_template.Bind(wx.EVT_BUTTON, self.OnTemplateFull)
     self.btn_template_simple.Bind(wx.EVT_BUTTON, self.OnTemplateShort)
     
     # *** Layout *** #
     
     lyt_top = BoxSizer(wx.HORIZONTAL)
     lyt_top.Add(wx.StaticText(self, label=GT(u'Available Templates')), 0,
             lyt.ALGN_CV)
     lyt_top.Add(self.sel_templates, 0, lyt.ALGN_CV|wx.LEFT, 5)
     lyt_top.Add(btn_template, 0, wx.LEFT, 5)
     lyt_top.Add(self.btn_template_simple)
     lyt_top.Add(btn_refresh)
     lyt_top.Add(btn_open)
     
     lyt_main = BoxSizer(wx.VERTICAL)
     lyt_main.AddSpacer(10)
     lyt_main.Add(lyt_top, 0, lyt.PAD_LR|wx.BOTTOM, 5)
     lyt_main.Add(self.dsp_copyright, 1, wx.EXPAND|lyt.PAD_LRB, 5)
     
     self.SetAutoLayout(True)
     self.SetSizer(lyt_main)
     self.Layout()
Esempio n. 21
0
    def __init__(self, parent):
        WizardPage.__init__(self, parent,
                            pgid.MENU)  #, name=GT(u'Menu Launcher'))

        ## Override default label
        self.Label = GT(u'Menu Launcher')

        # --- Buttons to open/preview/save .desktop file
        btn_open = CreateButton(self,
                                btnid.BROWSE,
                                GT(u'Browse'),
                                u'browse',
                                name=u'btn browse')
        btn_save = CreateButton(self,
                                btnid.SAVE,
                                GT(u'Save'),
                                u'save',
                                name=u'btn save')
        btn_preview = CreateButton(self,
                                   btnid.PREVIEW,
                                   GT(u'Preview'),
                                   u'preview',
                                   name=u'btn preview')

        # --- CHECKBOX
        chk_enable = CheckBox(self, chkid.ENABLE,
                              GT(u'Create system menu launcher'))

        # --- TYPE
        opts_type = (
            u'Application',
            u'Link',
            u'Directory',
        )

        txt_type = wx.StaticText(self, label=GT(u'Type'), name=u'type')
        ti_type = ComboBoxESS(self,
                              inputid.TYPE,
                              choices=opts_type,
                              name=u'Type',
                              defaultValue=opts_type[0])

        # --- ENCODING
        opts_enc = (
            u'UTF-1',
            u'UTF-7',
            u'UTF-8',
            u'CESU-8',
            u'UTF-EBCDIC',
            u'UTF-16',
            u'UTF-32',
            u'SCSU',
            u'BOCU-1',
            u'Punycode',
            u'GB 18030',
        )

        txt_enc = wx.StaticText(self, label=GT(u'Encoding'), name=u'encoding')
        ti_enc = ComboBoxESS(self,
                             inputid.ENC,
                             choices=opts_enc,
                             name=u'Encoding',
                             defaultValue=opts_enc[2])

        # --- TERMINAL
        chk_term = CheckBoxESS(self,
                               chkid.TERM,
                               GT(u'Terminal'),
                               name=u'Terminal')

        # --- STARTUP NOTIFY
        chk_notify = CheckBoxESS(self,
                                 chkid.NOTIFY,
                                 GT(u'Startup Notify'),
                                 name=u'StartupNotify',
                                 defaultValue=True)

        # --- Custom output filename
        txt_filename = wx.StaticText(self,
                                     txtid.FNAME,
                                     GT(u'Filename'),
                                     name=u'filename')
        ti_filename = TextArea(self, inputid.FNAME, name=txt_filename.Name)

        chk_filename = CheckBox(
            self,
            chkid.FNAME,
            GT(u'Use "Name" as output filename (<Name>.desktop)'),
            name=u'filename chk',
            defaultValue=True)

        # --- NAME (menu)
        txt_name = wx.StaticText(self, label=GT(u'Name'), name=u'name*')
        ti_name = TextAreaESS(self, inputid.NAME, name=u'Name')
        ti_name.req = True

        # --- EXECUTABLE
        txt_exec = wx.StaticText(self, label=GT(u'Executable'), name=u'exec')
        ti_exec = TextAreaESS(self, inputid.EXEC, name=u'Exec')

        # --- COMMENT
        txt_comm = wx.StaticText(self, label=GT(u'Comment'), name=u'comment')
        ti_comm = TextAreaESS(self, inputid.DESCR, name=u'Comment')

        # --- ICON
        txt_icon = wx.StaticText(self, label=GT(u'Icon'), name=u'icon')
        ti_icon = TextAreaESS(self, inputid.ICON, name=u'Icon')

        txt_mime = wx.StaticText(self, label=GT(u'MIME Type'), name=u'mime')
        ti_mime = TextAreaESS(self,
                              inputid.MIME,
                              defaultValue=wx.EmptyString,
                              name=u'MimeType')

        # ----- OTHER/CUSTOM
        txt_other = wx.StaticText(self,
                                  label=GT(u'Custom Fields'),
                                  name=u'other')
        ti_other = TextAreaPanel(self, inputid.OTHER, name=txt_other.Name)
        ti_other.EnableDropTarget()

        # --- CATEGORIES
        opts_category = (
            u'2DGraphics',
            u'Accessibility',
            u'Application',
            u'ArcadeGame',
            u'Archiving',
            u'Audio',
            u'AudioVideo',
            u'BlocksGame',
            u'BoardGame',
            u'Calculator',
            u'Calendar',
            u'CardGame',
            u'Compression',
            u'ContactManagement',
            u'Core',
            u'DesktopSettings',
            u'Development',
            u'Dictionary',
            u'DiscBurning',
            u'Documentation',
            u'Email',
            u'FileManager',
            u'FileTransfer',
            u'Game',
            u'GNOME',
            u'Graphics',
            u'GTK',
            u'HardwareSettings',
            u'InstantMessaging',
            u'KDE',
            u'LogicGame',
            u'Math',
            u'Monitor',
            u'Network',
            u'OCR',
            u'Office',
            u'P2P',
            u'PackageManager',
            u'Photography',
            u'Player',
            u'Presentation',
            u'Printing',
            u'Qt',
            u'RasterGraphics',
            u'Recorder',
            u'RemoteAccess',
            u'Scanning',
            u'Screensaver',
            u'Security',
            u'Settings',
            u'Spreadsheet',
            u'System',
            u'Telephony',
            u'TerminalEmulator',
            u'TextEditor',
            u'Utility',
            u'VectorGraphics',
            u'Video',
            u'Viewer',
            u'WordProcessor',
            u'Wine',
            u'Wine-Programs-Accessories',
            u'X-GNOME-NetworkSettings',
            u'X-GNOME-PersonalSettings',
            u'X-GNOME-SystemSettings',
            u'X-KDE-More',
            u'X-Red-Hat-Base',
            u'X-SuSE-ControlCenter-System',
        )

        txt_category = wx.StaticText(self,
                                     label=GT(u'Categories'),
                                     name=u'category')

        # This option does not get set by importing a new project
        ti_category = ComboBox(self,
                               inputid.CAT,
                               choices=opts_category,
                               name=txt_category.Name,
                               defaultValue=opts_category[0])

        btn_catadd = CreateButton(self,
                                  btnid.ADD,
                                  GT(u'Add'),
                                  u'add',
                                  name=u'add category')
        btn_catdel = CreateButton(self,
                                  btnid.REMOVE,
                                  GT(u'Remove'),
                                  u'remove',
                                  name=u'rm category')
        btn_catclr = CreateButton(self,
                                  btnid.CLEAR,
                                  GT(u'Clear'),
                                  u'clear',
                                  name=u'clear category')

        # FIXME: Allow using multi-select + remove
        lst_categories = ListCtrl(self, listid.CAT, name=u'Categories')
        # Can't set LC_SINGLE_SEL in constructor for wx 3.0 (ListCtrl bug???)
        lst_categories.SetSingleStyle(wx.LC_SINGLE_SEL)

        self.OnToggle()

        SetPageToolTips(self)

        # *** Event Handling *** #

        btn_open.Bind(wx.EVT_BUTTON, self.OnLoadLauncher)
        btn_save.Bind(wx.EVT_BUTTON, self.OnExportLauncher)
        btn_preview.Bind(wx.EVT_BUTTON, self.OnPreviewLauncher)

        chk_enable.Bind(wx.EVT_CHECKBOX, self.OnToggle)

        chk_filename.Bind(wx.EVT_CHECKBOX, self.OnSetCustomFilename)

        wx.EVT_KEY_DOWN(ti_category, self.SetCategory)
        wx.EVT_KEY_DOWN(lst_categories, self.SetCategory)
        btn_catadd.Bind(wx.EVT_BUTTON, self.SetCategory)
        btn_catdel.Bind(wx.EVT_BUTTON, self.SetCategory)
        btn_catclr.Bind(wx.EVT_BUTTON, self.OnClearCategories)

        # *** Layout *** #

        LEFT_CENTER = wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL
        LEFT_BOTTOM = lyt.ALGN_LB
        RIGHT_BOTTOM = wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM

        lyt_top = BoxSizer(wx.HORIZONTAL)
        lyt_top.Add(chk_enable, 0, LEFT_BOTTOM)
        lyt_top.AddStretchSpacer(1)
        lyt_top.Add(btn_open, 0, wx.ALIGN_TOP)
        lyt_top.Add(btn_save, 0, wx.ALIGN_TOP)
        lyt_top.Add(btn_preview, 0, wx.ALIGN_TOP)

        lyt_opts1 = wx.FlexGridSizer()
        lyt_opts1.SetCols(3)
        lyt_opts1.SetRows(2)

        lyt_opts1.Add(txt_type, 0, LEFT_CENTER)
        lyt_opts1.Add(ti_type, 0, wx.EXPAND | wx.LEFT, 5)
        lyt_opts1.Add(chk_term, 0, LEFT_CENTER | wx.LEFT, 5)
        lyt_opts1.Add(txt_enc, 0, LEFT_CENTER | wx.TOP, 5)
        lyt_opts1.Add(ti_enc, 0, lyt.PAD_LT, 5)
        lyt_opts1.Add(chk_notify, 0, LEFT_CENTER | lyt.PAD_LT, 5)

        lyt_mid = wx.GridBagSizer()
        lyt_mid.SetCols(4)
        lyt_mid.AddGrowableCol(1)
        lyt_mid.AddGrowableCol(3)

        # Row 1
        row = 0
        lyt_mid.Add(txt_filename, (row, 0), flag=LEFT_CENTER)
        lyt_mid.Add(ti_filename, (row, 1), flag=wx.EXPAND | wx.LEFT, border=5)
        lyt_mid.Add(chk_filename, (row, 2),
                    span=(1, 2),
                    flag=LEFT_CENTER | wx.LEFT,
                    border=5)

        # Row 2
        row += 1
        lyt_mid.Add(txt_name, (row, 0), flag=LEFT_CENTER | wx.TOP, border=5)
        lyt_mid.Add(ti_name, (row, 1), flag=wx.EXPAND | lyt.PAD_LT, border=5)
        lyt_mid.Add(txt_exec, (row, 2),
                    flag=LEFT_CENTER | lyt.PAD_LT,
                    border=5)
        lyt_mid.Add(ti_exec, (row, 3), flag=wx.EXPAND | lyt.PAD_LT, border=5)

        # Row 3
        row += 1
        lyt_mid.Add(txt_comm, (row, 0), flag=LEFT_CENTER | wx.TOP, border=5)
        lyt_mid.Add(ti_comm, (row, 1), flag=wx.EXPAND | lyt.PAD_LT, border=5)
        lyt_mid.Add(txt_icon, (row, 2),
                    flag=LEFT_CENTER | lyt.PAD_LT,
                    border=5)
        lyt_mid.Add(ti_icon, (row, 3), flag=wx.EXPAND | lyt.PAD_LT, border=5)

        # Row 4
        row += 1
        lyt_mid.Add(txt_mime, (row, 0), flag=LEFT_CENTER | wx.TOP, border=5)
        lyt_mid.Add(ti_mime, (row, 1), flag=wx.EXPAND | lyt.PAD_LT, border=5)

        lyt_bottom = wx.GridBagSizer()

        row = 0
        lyt_bottom.Add(txt_other, (row, 0), flag=LEFT_BOTTOM)
        lyt_bottom.Add(txt_category, (row, 2),
                       flag=LEFT_BOTTOM | wx.LEFT,
                       border=5)
        lyt_bottom.Add(ti_category, (row, 3),
                       flag=LEFT_BOTTOM | wx.LEFT,
                       border=5)
        lyt_bottom.Add(btn_catadd, (row, 4), flag=RIGHT_BOTTOM)
        lyt_bottom.Add(btn_catdel, (row, 5), flag=RIGHT_BOTTOM)
        lyt_bottom.Add(btn_catclr, (row, 6), flag=RIGHT_BOTTOM)

        row += 1
        lyt_bottom.Add(ti_other, (row, 0), (1, 2), wx.EXPAND)
        lyt_bottom.Add(lst_categories, (row, 2), (1, 5), wx.EXPAND | wx.LEFT,
                       5)

        lyt_bottom.AddGrowableRow(1)
        lyt_bottom.AddGrowableCol(1)
        lyt_bottom.AddGrowableCol(4)

        # --- Page 5 Sizer --- #
        lyt_main = BoxSizer(wx.VERTICAL)
        lyt_main.AddSpacer(5)
        lyt_main.Add(lyt_top, 0, wx.EXPAND | lyt.PAD_LR, 5)
        lyt_main.Add(lyt_opts1, 0, wx.EXPAND | lyt.PAD_LRT, 5)
        lyt_main.Add(lyt_mid, 0, wx.EXPAND | lyt.PAD_LRT, 5)
        lyt_main.Add(lyt_bottom, 1, wx.EXPAND | wx.ALL, 5)

        self.SetAutoLayout(True)
        self.SetSizer(lyt_main)
        self.Layout()