2015-02-18 16:43 GMT+01:00 Kai Huuhko <kai.huu...@gmail.com>: > 2015-02-17 0:24 GMT+02:00 Davide Andreoli <d...@gurumeditation.it>: > > 2015-02-16 22:10 GMT+01:00 Kai Huuhko <kai.huu...@gmail.com>: > > > >> 2015-02-16 21:57 GMT+02:00 Dave Andreoli <d...@gurumeditation.it>: > >> > davemds pushed a commit to branch master. > >> > > >> > > >> > http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=b4fcee3de22092d206747ba03275833917e9bbdb > >> > > >> > commit b4fcee3de22092d206747ba03275833917e9bbdb > >> > Author: Dave Andreoli <d...@gurumeditation.it> > >> > Date: Mon Feb 16 20:38:25 2015 +0100 > >> > > >> > Use consistent indentation style with the rest of the code > >> > --- > >> > CODING | 14 ++++++++++++++ > >> > efl/elementary/image.pyx | 25 ++++++++++++------------- > >> > examples/elementary/test_image.py | 23 +++++++++-------------- > >> > 3 files changed, 35 insertions(+), 27 deletions(-) > >> > > >> > diff --git a/CODING b/CODING > >> > index a5c4600..1e4f965 100644 > >> > --- a/CODING > >> > +++ b/CODING > >> > @@ -8,6 +8,20 @@ Style > >> > * When comparing C pointers with NULL, use == and != instead of the > >> python > >> > operator "is". This makes a visual distinction between python and C > >> code. > >> > > >> > +* For long lines that do not fit in the 80 cols please use only the > >> first > >> > + raccomandation from PEP-8 (Aligned with opening delimiter). > Example: > >> > + Yes: > >> > + foo = long_function_name(var_one, var_two, > >> > + var_three, var_four) > >> > + No: > >> > + foo = long_function_name( > >> > + var_one, var_two, > >> > + var_three, var_four) > >> > + > >> > + This to keep new code consistent with the rest of the bindings and > to > >> > + try to match the style of the C efl code style as much as possible. > >> > + ...also because I found it more readable and I like it more :P > >> -davemds- > >> > + > >> > >> > > Hey, nice to see you again, I was start to miss our discussion :P > > > > > >> WTF man? How about first at least having a discussion before enforcing > >> your personal code formatting style everywhere. > >> > > The "hanging indent" > >> style, which is the other "approved" style in pep-8 you quoted, has > >> been used in many places including the file you just re-formatted > >> entirely. > >> > > > > IMO the situation is exactly the opposite, you are enforcing your > preferred > > style in a project that never used that indentation, you cannot find any > > other > > usage of that style in code that is not written by you. And yes, I'm > > reverting to the "old style" indentation when I edit a file that use > "your" > > style. > > > > You are right, I did apply my preferred style when doing the pep-8 > formatting on the example files but the thing is, they did not have > any alignment style before. Also historically there was no consistent > formatting style in the Python bindings. > > > > >> Yes: Communication and co-operation > >> > >> No: Mussolini > >> > > > > We discussed this issue yet some months ago, you know I don't like that > > indentation, but still you insist to use it in python-efl. We are a > > democracy, > > and in democracy there must be the majority to make a choice...in our > > case the population is only 2, thus we must both agree to have the > majority > > and do a choice. > > > > There's no effective democracy amongst two votes. We are reasonable > adults, therefore we discuss, argue, and reach an agreement. At least > we can agree to disagree, and agree what we can do to move forward. > > My reasons why I prefer hanging indents: > - with a set line width rule, as we already have, they are more > economic when there are many parameters/members/etc. > fortunately we don't pay of a line number basis :)
> - the indentation is always aligned to a multiplier of the base > indentation (in our case: four spaces) which makes it easier to write. > yes, probably easier to write, but IMO harder to read as I tend to confuse continuation lines with real indentation lines > > So considering your strong opinion for using the vertical alignment > style, I will argue for allowing both styles. The original author of a > file will decide which style to use, or if there was no formatting > used, whoever edits the file first. If a file already has a formatting > style applied, it should be used for new edits. > > Does this sound reasonable to you? > sadly not, having some files with a style and others with a different one seems not reasonable to me. > > > > >> > >> > > >> > Design patterns > >> > =============== > >> > diff --git a/efl/elementary/image.pyx b/efl/elementary/image.pyx > >> > index 79cb7e3..e39ea59 100644 > >> > --- a/efl/elementary/image.pyx > >> > +++ b/efl/elementary/image.pyx > >> > @@ -195,19 +195,18 @@ cdef class Image(Object): > >> > self._set_properties_from_keyword_args(kwargs) > >> > > >> > def memfile_set(self, img, size, format=None, key=None): > >> > - """ > >> > - Set a location in memory to be used as an image object's > source > >> > + """Set a location in memory to be used as an image object's > >> source > >> > bitmap. > >> > > >> > This function is handy when the contents of an image file are > >> > mapped in memory, for example. > >> > > >> > The ``format`` string should be something like ``"png"``, > >> ``"jpg"``, > >> > - ``"tga"``, ``"tiff"``, ``"bmp"`` etc, when provided. This > >> improves the loader performance as it tries the > >> > - "correct" loader first, before trying a range of other > possible > >> > - loaders until one succeeds. > >> > + ``"tga"``, ``"tiff"``, ``"bmp"`` etc, when provided. This > >> improves > >> > + the loader performance as it tries the "correct" loader > first, > >> > + before trying a range of other possible loaders until one > >> succeeds. > >> > > >> > - :return: (``True`` = success, ``False`` = error) > >> > + :return: ``True`` = success, ``False`` = error > >> > > >> > .. versionadded:: 1.14 > >> > > >> > @@ -216,6 +215,7 @@ cdef class Image(Object): > >> > :param format: (Optional) expected format of ``img`` bytes > >> > :param key: Optional indexing key of ``img`` to be passed to > the > >> > image loader (eg. if ``img`` is a memory-mapped EET file) > >> > + > >> > """ > >> > cdef Py_buffer view > >> > > >> > @@ -227,13 +227,12 @@ cdef class Image(Object): > >> > > >> > PyObject_GetBuffer(img, &view, PyBUF_SIMPLE) > >> > > >> > - ret = bool(elm_image_memfile_set( > >> > - self.obj, > >> > - <void *>view.buf, > >> > - size, > >> > - <const char *>format if format else NULL, > >> > - <const char *>key if key else NULL > >> > - )) > >> > + ret = bool(elm_image_memfile_set(self.obj, > >> > + <void *>view.buf, > >> > + size, > >> > + <const char *>format if > format > >> else NULL, > >> > + <const char *>key if key > else > >> NULL > >> > + )) > >> > > >> > PyBuffer_Release(&view) > >> > > >> > diff --git a/examples/elementary/test_image.py > >> b/examples/elementary/test_image.py > >> > index e095cf2..4203c40 100644 > >> > --- a/examples/elementary/test_image.py > >> > +++ b/examples/elementary/test_image.py > >> > @@ -61,9 +61,8 @@ def image_clicked(obj, it=None): > >> > win.resize_object_add(vbox) > >> > vbox.show() > >> > > >> > - im = Image( > >> > - win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH, > >> > - file=os.path.join(img_path, "logo.png")) > >> > + im = Image(win, size_hint_weight=EXPAND_BOTH, > >> size_hint_align=FILL_BOTH, > >> > + file=os.path.join(img_path, "logo.png")) > >> > vbox.pack_end(im) > >> > im.show() > >> > > >> > @@ -71,9 +70,8 @@ def image_clicked(obj, it=None): > >> > vbox.pack_end(sep) > >> > sep.show() > >> > > >> > - hbox = Box( > >> > - win, layout=ELM_BOX_LAYOUT_FLOW_HORIZONTAL, > >> > - size_hint_align=FILL_BOTH) > >> > + hbox = Box(win, layout=ELM_BOX_LAYOUT_FLOW_HORIZONTAL, > >> > + size_hint_align=FILL_BOTH) > >> > vbox.pack_end(hbox) > >> > hbox.show() > >> > > >> > @@ -96,9 +94,8 @@ def image_clicked(obj, it=None): > >> > b.callback_clicked_add(lambda b: im.file_set(remote_url)) > >> > b.show() > >> > > >> > - pb = Progressbar( > >> > - win, size_hint_weight=EXPAND_BOTH, > >> > - size_hint_align=FILL_BOTH) > >> > + pb = Progressbar(win, size_hint_weight=EXPAND_BOTH, > >> > + size_hint_align=FILL_BOTH) > >> > hbox.pack_end(pb) > >> > pb.show() > >> > > >> > @@ -118,8 +115,7 @@ def image2_clicked(obj, it=None): > >> > vbox = Box(win, size_hint_weight=EXPAND_BOTH, > >> size_hint_align=FILL_BOTH) > >> > win.resize_object_add(vbox) > >> > > >> > - im = Image( > >> > - win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) > >> > + im = Image(win, size_hint_weight=EXPAND_BOTH, > >> size_hint_align=FILL_BOTH) > >> > > >> > with open(os.path.join(img_path, "logo.png"), "rb") as fp: > >> > image_data = fp.read() > >> > @@ -133,9 +129,8 @@ def image2_clicked(obj, it=None): > >> > > >> > if __name__ == "__main__": > >> > elementary.init() > >> > - win = StandardWindow( > >> > - "test", "python-elementary test application", > >> > - size=(320, 520)) > >> > + win = StandardWindow("test", "python-elementary test > application", > >> > + size=(320, 520)) > >> > win.callback_delete_request_add(lambda o: elementary.exit()) > >> > > >> > box0 = Box(win, size_hint_weight=EXPAND_BOTH) > >> > > >> > -- > >> > > >> > > >> > >> > >> > ------------------------------------------------------------------------------ > >> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > >> from Actuate! Instantly Supercharge Your Business Reports and Dashboards > >> with Interactivity, Sharing, Native Excel Exports, App Integration & > more > >> Get technology previously reserved for billion-dollar corporations, FREE > >> > >> > http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk > >> _______________________________________________ > >> enlightenment-devel mailing list > >> enlightenment-devel@lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > >> > > > ------------------------------------------------------------------------------ > > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > > from Actuate! Instantly Supercharge Your Business Reports and Dashboards > > with Interactivity, Sharing, Native Excel Exports, App Integration & more > > Get technology previously reserved for billion-dollar corporations, FREE > > > http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk > > _______________________________________________ > > enlightenment-devel mailing list > > enlightenment-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > > > ------------------------------------------------------------------------------ > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > from Actuate! Instantly Supercharge Your Business Reports and Dashboards > with Interactivity, Sharing, Native Excel Exports, App Integration & more > Get technology previously reserved for billion-dollar corporations, FREE > > http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk > _______________________________________________ > enlightenment-devel mailing list > enlightenment-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel