我使用python调试器pdb.我使用emacs进行python编程.我使用python-mode.el.我的想法是使emacs直观.所以我需要python程序的以下帮助(.py)
每当我按'F9'键时,emacs应该输入"import pdb; pdb.set_trace();" 当前行中的语句并将当前行移动到下面的一行.句子在同一行.聪明的缩进可能会有所帮助.
无论在哪里"import pdb; pdb.set_trace();" 语句在python代码中显示,emacs应显示左指示符并突出显示该行.
当我在当前行按"Alt-F9"键时,emacs找到"import pdb; pdb.set_trace();" 声明然后,emacs应该删除"import pdb; pdb.set_trace();" 行并将当前行移动到一行.
每当我按"F8"键,emacs就会跳转到"import pdb; pdb.set_trace();" 在同一缓冲区中.
我正在尝试学习elisp并尽快赶上lisp来自己定制emacs.我将非常感谢你的回答.
对我来说答案应该足够大,而找到这个解决方案的其他人也非常有用.
我有一个自定义ListView列表的每一行由一个ImageView和两个组成TextView.我想在单击列表项目时将文本的颜色更改为白色(仅在单击的项目中).此外,当项目"未被点击"时(当"按下"被释放时),我想将颜色更改为黑色.单击以下内容时,我已经使项目的背景颜色发生了变化list_item_bg.xml:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="false"
android:state_pressed="false"
android:drawable="@color/white" />
<item android:state_pressed="true"
android:drawable="@color/red_destaques" />
<item android:state_selected="true"
android:drawable="@color/red_destaques" />
</selector>
Run Code Online (Sandbox Code Playgroud)
而且listitem_row.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="50dip"
xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="5dip"
android:maxHeight="50dip"
android:adjustViewBounds="true"
android:background="@color/list_item_bg">
<ImageView
android:layout_width="70dip"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:adjustViewBounds="true"
android:scaleType="fitStart"
android:src="@drawable/imagem_padrao_lista"
android:id="@+id/listItemLogo">
</ImageView>
<TextView
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_height="wrap_content"
android:text="TextView"
android:layout_width="wrap_content"
android:layout_toRightOf="@+id/listItemLogo"
android:layout_toLeftOf="@+id/listItemArrow"
android:textColor="#000000"
android:layout_marginLeft="5dip"
android:adjustViewBounds="true"
android:id="@+id/listItemTitle">
</TextView>
<TextView
android:layout_height="wrap_content"
android:text="TextView"
android:layout_width="wrap_content"
android:layout_toRightOf="@+id/listItemLogo"
android:layout_below="@+id/listItemTitle"
android:textColor="#333333"
android:layout_marginLeft="5dip"
android:adjustViewBounds="true"
android:id="@+id/listItemDescription">
</TextView>
<ImageView android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentRight="true" android:src="@drawable/setinha_navegacao" …Run Code Online (Sandbox Code Playgroud) 在Python中,一切都有一个类.因此dict也有一类.
所以,从理论上讲,我应该能够改变keyvalue赋值行为的实现.
例:
d = dict()
d['first'] = 3 # Internally d['first'] is stored as 6 [i.e. value*2 if value is INT]
print d['first'] # should print 6
d['second'] = 4
print d['second'] # should print 8
Run Code Online (Sandbox Code Playgroud)
我注意到大多数对象都有OBJECT.__dict__或列出的属性vars(OBJECT).但是,这是不是情况dict或list.
如何通过覆盖dict.__setattr__()方法获得所需的行为?
我正在尝试创建一个自定义清理方法,如果一个特定数据的值已经存在,则查看数据库,如果是,则会引发错误.我正在使用继承自其他类(项目)的类(子系统)的模型形式.当我尝试在表单中添加新的sybsystem时,我想检查sybsystem是否已经存在.
我在视图函数中获取项目名称.
class SubsytemForm(forms.ModelForm):
class Meta:
model = Subsystem
exclude = ('project_name')
def clean(self,project_name):
cleaned_data = super(SubsytemForm, self).clean(self,project_name)
form_subsystem_name = cleaned_data.get("subsystem_name")
Subsystem.objects.filter(project__project_name=project_name)
subsystem_objects=Subsystem.objects.filter(project__project_name=project_name)
nb_subsystem = subsystem_objects.count()
for i in range (nb_subsystem):
if (subsystem_objects[i].subsystem_name==form_subsystem_name):
msg = u"Subsystem already existing"
self._errors["subsystem_name"] = self.error_class([msg])
# These fields are no longer valid. Remove them from the
# cleaned data.
del cleaned_data["subsystem_name"]
return cleaned_data
Run Code Online (Sandbox Code Playgroud)
我的观点功能:
def addform(request,project_name):
if form.is_valid():
form=form.save(commit=False)
form.project_id=Project.objects.get(project_name=project_name).id
form.clean(form,project_name)
form.save()
Run Code Online (Sandbox Code Playgroud)
这不起作用,我不知道该怎么办.我有错误:clean()需要2个参数(给定1个)
我的模特:
class Project(models.Model):
project_name = models.CharField("Project name", max_length=20)
Class Subsystem(models.Model):
subsystem_name …Run Code Online (Sandbox Code Playgroud) 目前我正在尝试在UITableViewCell中自定义delte按钮.现在我有类似的东西:

现在,我需要的只是改变这个按钮的颜色,我不想改变行为,或者让它绝对自定义.我确信这是可能的,没有创建自己的控件来删除UITableView中的行.
这是我的代码:
- (void)layoutSubviews
{
[super layoutSubviews];
for (UIView *subview in self.subviews) {
if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationControl"]) {
UIView *deleteButtonView = (UIView *)[subview.subviews objectAtIndex:0];
deleteButtonView.backgroundColor = [UIColor greenColor];
}
}
}
Run Code Online (Sandbox Code Playgroud)
我怎么能这样做?
提前致谢!
如果我想在链接插件中添加选项卡,那么最佳实践方法是什么?我不想改变发布代码只是用我的自定义版本覆盖它.所以用新版本更新很容易.CKEDITOR 4.2是否有这方面的操作方法?我正在使用新的内联样式工具栏.
如果我得到源代码,我可以重建没有链接插件的发布版本吗?然后使用我的自定义版本的链接插件做一个外部插件?
我无法弄清楚如何访问environment.filters.在标准的Jinja2示例中,我可以看到datetimeformat过滤器的示例:
def datetimeformat(value, format='%H:%M / %d-%m-%Y'):
return value.strftime(format)
Run Code Online (Sandbox Code Playgroud)
然后我们可以添加过滤器:
environment.filters['datetimeformat'] = datetimeformat
Run Code Online (Sandbox Code Playgroud)
但我附加了django_jinja应用程序,现在使用django.shortcuts的一个标准render_to_response方法(Jinja的宏,内置函数工作正常).所以我的观点得到了这样的回应
return render_to_response( html_template, result_dict )
Run Code Online (Sandbox Code Playgroud)
我只包括Jinja2应用程序,不用担心构建自定义Jinja2响应,但我不知道如何访问环境.
使用django_jinja应用程序添加自定义模板过滤器应该更改什么?
以下是该应用程序的说明:https://pypi.python.org/pypi/django-jinja/0.8.
是否可以在Powershell中创建自定义运算符?而且,我该怎么做?我搜索过谷歌,但没有任何事情发生.
我指的是一个特定的中缀运算符:
$ ExampleList -contains "元素"
我创建了cmdlet(使用Powershell和C#),模块等,所以我只需要广泛的笔画.
我尝试使用插件寄存器/组件在vuepress中添加组件的自定义目录,但似乎不可能.
我试过了
module.exports = {
title: 'Hello VuePress',
description: 'Just playing around',
plugins: [
[
'register-components',
{
componentDir: '../components'
}
]
]
}
Run Code Online (Sandbox Code Playgroud)
用这种架构(我想选择"组件"目录)
但它似乎不起作用,因为组件未被识别
我认为我在base-button.md中写好了我的组件
有人能帮助我告诉我到达那里的步骤吗?
非常感谢
customization ×10
python ×3
django ×2
ios ×2
objective-c ×2
android ×1
ckeditor ×1
components ×1
debugging ×1
dictionary ×1
elisp ×1
emacs ×1
forms ×1
internals ×1
iphone ×1
jinja2 ×1
listview ×1
powershell ×1
types ×1
uitableview ×1
uiview ×1
vue.js ×1
vuepress ×1